NPE when using exclude rules

View: New views
13 Messages — Rating Filter:   Alert me  

NPE when using exclude rules

by Rafael Serrano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I am currently migrating from 0.5 to 0.6 and have almost succeeded (thanks to the breaking changes doc) except for the exclusion of transitive dependencies. Actually, I'm getting a NPE when I try to iterate over the files in a configuration.

Here is a code snippet:
configurations {
   all*.exclude group: "hsqldb"
}
dependencies {
   compile "a-jar-that-depends-on-hsqldb"
}
task "myTask" << {
        configurations.testRuntime.each { file -> println file }
}

Is this really a bug or am I doing something wrong? In case it is a bug, could you please think of a workaround?

Thanks in advance. Regards
Rafa

PS: In case it helps, here is the stacktrace
Execution failed for task ':myTask'.
        at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:183)
        at org.gradle.execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:153)
        at org.gradle.execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:144)
        at org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
        at org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:88)
        at org.gradle.Gradle.runInternal(Gradle.java:121)
        at org.gradle.Gradle.run(Gradle.java:93)
        at org.gradle.Main.execute(Main.java:253)
        at org.gradle.Main.main(Main.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
        at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver.resolveAsReport(DefaultIvyDependencyResolver.java:72)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyService.resolveAsReportInternal(DefaultIvyService.java:120)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyService.resolveAsReport(DefaultIvyService.java:110)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveAsReport(DefaultConfiguration.java:156)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolve(DefaultConfiguration.java:147)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:175)
        at org.gradle.api.internal.artifacts.AbstractFileCollection.iterator(AbstractFileCollection.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
        at org.codehaus.groovy.runtime.InvokerHelper.asIterator(InvokerHelper.java:506)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1056)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
        at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
        at build_gradle$_run_closure13.doCall(build_gradle:202)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:778)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
        at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy:94)
        at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy)
        at org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:219)
        at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:174)
        ... 13 common frames omitted
Caused by: java.lang.NullPointerException
        at org.apache.ivy.plugins.matcher.ExactPatternMatcher$ExactMatcher.matches(ExactPatternMatcher.java:46)
        at org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:34)
        at org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:38)
        at org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:49)
        at org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.doesExclude(DefaultModuleDescriptor.java:627)
        at org.apache.ivy.core.resolve.IvyNodeCallers.doesExclude(IvyNodeCallers.java:288)
        at org.apache.ivy.core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:269)
        at org.apache.ivy.core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:251)
        at org.apache.ivy.core.resolve.IvyNode.getArtifacts(IvyNode.java:830)
        at org.apache.ivy.core.resolve.IvyNode.getSelectedArtifacts(IvyNode.java:739)
        at org.apache.ivy.core.report.ResolveReport.setDependencies(ResolveReport.java:235)
        at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:236)
        at org.apache.ivy.Ivy.resolve(Ivy.java:512)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver.resolveAsReport(DefaultIvyDependencyResolver.java:68)
        ... 59 common frames omitted

Re: NPE when using exclude rules

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rafa,

I can't reproduce this. The following code works for me (MetaModel has  
a dependency on hsqldb):

usePlugin 'java'

repositories {
        mavenCentral()
}

configurations {
   all*.exclude group: "hsqldb"
}

dependencies {
        compile "dk.eobjects.commons:MetaModel:1.0.7"
}

task myTask << {
        configurations.testRuntime.each { file -> println file }
}

P.S. You don't need to quote the task name any more when creating it.

Could you create a test case and file a Jira?

- Hans

On May 26, 2009, at 8:11 PM, Rafael Serrano wrote:

>
> Hi all,
>
> I am currently migrating from 0.5 to 0.6 and have almost succeeded  
> (thanks
> to the breaking changes doc) except for the exclusion of transitive
> dependencies. Actually, I'm getting a NPE when I try to iterate over  
> the
> files in a configuration.
>
> Here is a code snippet:
> configurations {
>   all*.exclude group: "hsqldb"
> }
> dependencies {
>   compile "a-jar-that-depends-on-hsqldb"
> }
> task "myTask" << {
> configurations.testRuntime.each { file -> println file }
> }
>
> Is this really a bug or am I doing something wrong? In case it is a  
> bug,
> could you please think of a workaround?
>
> Thanks in advance. Regards
> Rafa
>
> PS: In case it helps, here is the stacktrace
> Execution failed for task ':myTask'.
> at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:
> 183)
> at
> org
> .gradle
> .execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:
> 153)
> at
> org
> .gradle
> .execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:144)
> at
> org
> .gradle
> .execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
> at
> org
> .gradle
> .execution
> .TaskNameResolvingBuildExecuter
> .execute(TaskNameResolvingBuildExecuter.java:88)
> at org.gradle.Gradle.runInternal(Gradle.java:121)
> at org.gradle.Gradle.run(Gradle.java:93)
> at org.gradle.Main.execute(Main.java:253)
> at org.gradle.Main.main(Main.java:83)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .ivyservice
> .DefaultIvyDependencyResolver
> .resolveAsReport(DefaultIvyDependencyResolver.java:72)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .ivyservice
> .DefaultIvyService.resolveAsReportInternal(DefaultIvyService.java:120)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .ivyservice.DefaultIvyService.resolveAsReport(DefaultIvyService.java:
> 110)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .configurations
> .DefaultConfiguration.resolveAsReport(DefaultConfiguration.java:156)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .configurations
> .DefaultConfiguration.resolve(DefaultConfiguration.java:147)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .configurations
> .DefaultConfiguration.getFiles(DefaultConfiguration.java:175)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .AbstractFileCollection.iterator(AbstractFileCollection.java:48)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at  
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 86)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
> at
> org
> .codehaus
> .groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
> at
> org
> .codehaus
> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
> at
> org
> .codehaus.groovy.runtime.InvokerHelper.asIterator(InvokerHelper.java:
> 506)
> at
> org
> .codehaus
> .groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:
> 1056)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org
> .codehaus
> .groovy
> .runtime
> .metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
> at
> org
> .codehaus
> .groovy
> .runtime
> .metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
> at
> org
> .codehaus
> .groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
> at
> org
> .codehaus
> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
> at
> org
> .codehaus
> .groovy
> .runtime
> .ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
> at build_gradle$_run_closure13.doCall(build_gradle:202)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at  
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 86)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
> at
> org
> .codehaus
> .groovy
> .runtime
> .metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
> at
> org
> .codehaus
> .groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:778)
> at
> org
> .codehaus
> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
> at
> org
> .codehaus
> .groovy
> .runtime
> .ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
> at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy:94)
> at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy)
> at org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:
> 219)
> at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:
> 174)
> ... 13 common frames omitted
> Caused by: java.lang.NullPointerException
> at
> org.apache.ivy.plugins.matcher.ExactPatternMatcher
> $ExactMatcher.matches(ExactPatternMatcher.java:46)
> at
> org
> .apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:
> 34)
> at
> org
> .apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:
> 38)
> at
> org
> .apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:
> 49)
> at
> org
> .apache
> .ivy
> .core
> .module
> .descriptor
> .DefaultModuleDescriptor.doesExclude(DefaultModuleDescriptor.java:627)
> at
> org
> .apache
> .ivy.core.resolve.IvyNodeCallers.doesExclude(IvyNodeCallers.java:288)
> at
> org
> .apache
> .ivy
> .core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:
> 269)
> at
> org
> .apache
> .ivy
> .core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:
> 251)
> at org.apache.ivy.core.resolve.IvyNode.getArtifacts(IvyNode.java:830)
> at
> org
> .apache.ivy.core.resolve.IvyNode.getSelectedArtifacts(IvyNode.java:
> 739)
> at
> org
> .apache
> .ivy.core.report.ResolveReport.setDependencies(ResolveReport.java:235)
> at
> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:
> 236)
> at org.apache.ivy.Ivy.resolve(Ivy.java:512)
> at
> org
> .gradle
> .api
> .internal
> .artifacts
> .ivyservice
> .DefaultIvyDependencyResolver
> .resolveAsReport(DefaultIvyDependencyResolver.java:68)
> ... 59 common frames omitted
> --
> View this message in context: http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23728395.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by LightGuard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How is this working with Ivy?  AFAIK this is broken in Ivy.

Jason Porter
Real Programmers think better when playing Adventure or Rogue.

PGP key id: 926CCFF5
PGP fingerprint: 64C2 C078 13A9 5B23 7738 F7E5 1046 C39B 926C CFF5
PGP key available at: keyserver.net, pgp.mit.edu



On Tue, May 26, 2009 at 12:38, Hans Dockter <mail@...> wrote:

> Hi Rafa,
>
> I can't reproduce this. The following code works for me (MetaModel has a
> dependency on hsqldb):
>
> usePlugin 'java'
>
> repositories {
>        mavenCentral()
> }
>
> configurations {
>  all*.exclude group: "hsqldb"
> }
>
> dependencies {
>        compile "dk.eobjects.commons:MetaModel:1.0.7"
> }
>
> task myTask << {
>        configurations.testRuntime.each { file -> println file }
> }
>
> P.S. You don't need to quote the task name any more when creating it.
>
> Could you create a test case and file a Jira?
>
> - Hans
>
> On May 26, 2009, at 8:11 PM, Rafael Serrano wrote:
>
>>
>> Hi all,
>>
>> I am currently migrating from 0.5 to 0.6 and have almost succeeded (thanks
>> to the breaking changes doc) except for the exclusion of transitive
>> dependencies. Actually, I'm getting a NPE when I try to iterate over the
>> files in a configuration.
>>
>> Here is a code snippet:
>> configurations {
>>  all*.exclude group: "hsqldb"
>> }
>> dependencies {
>>  compile "a-jar-that-depends-on-hsqldb"
>> }
>> task "myTask" << {
>>        configurations.testRuntime.each { file -> println file }
>> }
>>
>> Is this really a bug or am I doing something wrong? In case it is a bug,
>> could you please think of a workaround?
>>
>> Thanks in advance. Regards
>> Rafa
>>
>> PS: In case it helps, here is the stacktrace
>> Execution failed for task ':myTask'.
>>        at
>> org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:183)
>>        at
>>
>> org.gradle.execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:153)
>>        at
>>
>> org.gradle.execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:144)
>>        at
>>
>> org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
>>        at
>>
>> org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:88)
>>        at org.gradle.Gradle.runInternal(Gradle.java:121)
>>        at org.gradle.Gradle.run(Gradle.java:93)
>>        at org.gradle.Main.execute(Main.java:253)
>>        at org.gradle.Main.main(Main.java:83)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
>> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>>        at
>>
>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver.resolveAsReport(DefaultIvyDependencyResolver.java:72)
>>        at
>>
>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyService.resolveAsReportInternal(DefaultIvyService.java:120)
>>        at
>>
>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyService.resolveAsReport(DefaultIvyService.java:110)
>>        at
>>
>> org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveAsReport(DefaultConfiguration.java:156)
>>        at
>>
>> org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolve(DefaultConfiguration.java:147)
>>        at
>>
>> org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:175)
>>        at
>>
>> org.gradle.api.internal.artifacts.AbstractFileCollection.iterator(AbstractFileCollection.java:48)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.asIterator(InvokerHelper.java:506)
>>        at
>>
>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1056)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>>
>> org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
>>        at
>>
>> org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)
>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>        at
>>
>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>        at build_gradle$_run_closure13.doCall(build_gradle:202)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>        at
>>
>> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
>>        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:778)
>>        at
>>
>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
>>        at
>>
>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>        at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy:94)
>>        at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy)
>>        at
>> org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:219)
>>        at
>> org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:174)
>>        ... 13 common frames omitted
>> Caused by: java.lang.NullPointerException
>>        at
>>
>> org.apache.ivy.plugins.matcher.ExactPatternMatcher$ExactMatcher.matches(ExactPatternMatcher.java:46)
>>        at
>>
>> org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:34)
>>        at
>>
>> org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:38)
>>        at
>>
>> org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:49)
>>        at
>>
>> org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.doesExclude(DefaultModuleDescriptor.java:627)
>>        at
>>
>> org.apache.ivy.core.resolve.IvyNodeCallers.doesExclude(IvyNodeCallers.java:288)
>>        at
>>
>> org.apache.ivy.core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:269)
>>        at
>>
>> org.apache.ivy.core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:251)
>>        at
>> org.apache.ivy.core.resolve.IvyNode.getArtifacts(IvyNode.java:830)
>>        at
>> org.apache.ivy.core.resolve.IvyNode.getSelectedArtifacts(IvyNode.java:739)
>>        at
>>
>> org.apache.ivy.core.report.ResolveReport.setDependencies(ResolveReport.java:235)
>>        at
>> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:236)
>>        at org.apache.ivy.Ivy.resolve(Ivy.java:512)
>>        at
>>
>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver.resolveAsReport(DefaultIvyDependencyResolver.java:68)
>>        ... 59 common frames omitted
>> --
>> View this message in context:
>> http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23728395.html
>> Sent from the gradle-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
> --
> Hans Dockter
> Gradle Project Manager
> http://www.gradle.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 26, 2009, at 8:45 PM, Jason Porter wrote:

> How is this working with Ivy?  AFAIK this is broken in Ivy.

Not that I know off. What exactly do you mean is broken? The whole Ivy  
exclude mechanism?

- Hans

>
>
> Jason Porter
> Real Programmers think better when playing Adventure or Rogue.
>
> PGP key id: 926CCFF5
> PGP fingerprint: 64C2 C078 13A9 5B23 7738 F7E5 1046 C39B 926C CFF5
> PGP key available at: keyserver.net, pgp.mit.edu
>
>
>
> On Tue, May 26, 2009 at 12:38, Hans Dockter <mail@...> wrote:
>> Hi Rafa,
>>
>> I can't reproduce this. The following code works for me (MetaModel  
>> has a
>> dependency on hsqldb):
>>
>> usePlugin 'java'
>>
>> repositories {
>>        mavenCentral()
>> }
>>
>> configurations {
>>  all*.exclude group: "hsqldb"
>> }
>>
>> dependencies {
>>        compile "dk.eobjects.commons:MetaModel:1.0.7"
>> }
>>
>> task myTask << {
>>        configurations.testRuntime.each { file -> println file }
>> }
>>
>> P.S. You don't need to quote the task name any more when creating it.
>>
>> Could you create a test case and file a Jira?
>>
>> - Hans
>>
>> On May 26, 2009, at 8:11 PM, Rafael Serrano wrote:
>>
>>>
>>> Hi all,
>>>
>>> I am currently migrating from 0.5 to 0.6 and have almost succeeded  
>>> (thanks
>>> to the breaking changes doc) except for the exclusion of transitive
>>> dependencies. Actually, I'm getting a NPE when I try to iterate  
>>> over the
>>> files in a configuration.
>>>
>>> Here is a code snippet:
>>> configurations {
>>>  all*.exclude group: "hsqldb"
>>> }
>>> dependencies {
>>>  compile "a-jar-that-depends-on-hsqldb"
>>> }
>>> task "myTask" << {
>>>        configurations.testRuntime.each { file -> println file }
>>> }
>>>
>>> Is this really a bug or am I doing something wrong? In case it is  
>>> a bug,
>>> could you please think of a workaround?
>>>
>>> Thanks in advance. Regards
>>> Rafa
>>>
>>> PS: In case it helps, here is the stacktrace
>>> Execution failed for task ':myTask'.
>>>        at
>>> org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:183)
>>>        at
>>>
>>> org
>>> .gradle
>>> .execution
>>> .DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:153)
>>>        at
>>>
>>> org
>>> .gradle
>>> .execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:
>>> 144)
>>>        at
>>>
>>> org
>>> .gradle
>>> .execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
>>>        at
>>>
>>> org
>>> .gradle
>>> .execution
>>> .TaskNameResolvingBuildExecuter
>>> .execute(TaskNameResolvingBuildExecuter.java:88)
>>>        at org.gradle.Gradle.runInternal(Gradle.java:121)
>>>        at org.gradle.Gradle.run(Gradle.java:93)
>>>        at org.gradle.Main.execute(Main.java:253)
>>>        at org.gradle.Main.main(Main.java:83)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>>> Method)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
>>> Caused by: java.lang.RuntimeException:  
>>> java.lang.NullPointerException
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .ivyservice
>>> .DefaultIvyDependencyResolver
>>> .resolveAsReport(DefaultIvyDependencyResolver.java:72)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .ivyservice
>>> .DefaultIvyService.resolveAsReportInternal(DefaultIvyService.java:
>>> 120)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .ivyservice
>>> .DefaultIvyService.resolveAsReport(DefaultIvyService.java:110)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .configurations
>>> .DefaultConfiguration.resolveAsReport(DefaultConfiguration.java:156)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .configurations
>>> .DefaultConfiguration.resolve(DefaultConfiguration.java:147)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .configurations
>>> .DefaultConfiguration.getFiles(DefaultConfiguration.java:175)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .AbstractFileCollection.iterator(AbstractFileCollection.java:48)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>>> Method)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>> org
>>> .codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
>>> 86)
>>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>>        at  
>>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>>        at  
>>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:
>>> 766)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.asIterator(InvokerHelper.java:506)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy
>>> .runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1056)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>>> Method)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy
>>> .runtime
>>> .metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy
>>> .runtime
>>> .metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:
>>> 54)
>>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>>        at  
>>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>>        at  
>>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:
>>> 766)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy
>>> .runtime
>>> .ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>>        at build_gradle$_run_closure13.doCall(build_gradle:202)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>>> Method)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>> org
>>> .codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
>>> 86)
>>>        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy
>>> .runtime
>>> .metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
>>>        at  
>>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:
>>> 778)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
>>>        at
>>>
>>> org
>>> .codehaus
>>> .groovy
>>> .runtime
>>> .ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>>        at  
>>> org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy:94)
>>>        at  
>>> org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy)
>>>        at
>>> org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:
>>> 219)
>>>        at
>>> org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:174)
>>>        ... 13 common frames omitted
>>> Caused by: java.lang.NullPointerException
>>>        at
>>>
>>> org.apache.ivy.plugins.matcher.ExactPatternMatcher
>>> $ExactMatcher.matches(ExactPatternMatcher.java:46)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:34)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:38)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:49)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy
>>> .core
>>> .module
>>> .descriptor
>>> .DefaultModuleDescriptor.doesExclude(DefaultModuleDescriptor.java:
>>> 627)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy.core.resolve.IvyNodeCallers.doesExclude(IvyNodeCallers.java:
>>> 288)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy
>>> .core
>>> .resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:269)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy
>>> .core
>>> .resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:251)
>>>        at
>>> org.apache.ivy.core.resolve.IvyNode.getArtifacts(IvyNode.java:830)
>>>        at
>>> org
>>> .apache.ivy.core.resolve.IvyNode.getSelectedArtifacts(IvyNode.java:
>>> 739)
>>>        at
>>>
>>> org
>>> .apache
>>> .ivy.core.report.ResolveReport.setDependencies(ResolveReport.java:
>>> 235)
>>>        at
>>> org
>>> .apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:
>>> 236)
>>>        at org.apache.ivy.Ivy.resolve(Ivy.java:512)
>>>        at
>>>
>>> org
>>> .gradle
>>> .api
>>> .internal
>>> .artifacts
>>> .ivyservice
>>> .DefaultIvyDependencyResolver
>>> .resolveAsReport(DefaultIvyDependencyResolver.java:68)
>>>        ... 59 common frames omitted
>>> --
>>> View this message in context:
>>> http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23728395.html
>>> Sent from the gradle-user mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>   http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> --
>> Hans Dockter
>> Gradle Project Manager
>> http://www.gradle.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by Rafael Serrano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Hans,

Thanks for the quick reply. I over-simplified my use case and that example works, but I have just found the problem and it comes when using a flatDir resolver. Here is a failing script:
repositories {
        flatDir name: 'lib', dirs: "src/lib"
    mavenCentral().checkconsistency = false
}

configurations {
        all*.exclude group: "hsqldb"
}

dependencies {
        compile "dk.eobjects.commons:MetaModel:1.0.7"
        compile ":gdata-core:1.0"
}

task myTask << {
        configurations.testRuntime.each { file -> println file }
}

The problem seem to be that I can't reference any library with an empty group, so I have changed my dependency to:
compile "a:gdata-core:1.0"
but didn't moved my JAR, i.e. it was still under "src/lib", and it worked! This workaround is working for me, but anyway I'm gonna post a JIRA on this.

Thanks for your help. Regards
Rafa

hdockter wrote:
Hi Rafa,

I can't reproduce this. The following code works for me (MetaModel has  
a dependency on hsqldb):

usePlugin 'java'

repositories {
        mavenCentral()
}

configurations {
   all*.exclude group: "hsqldb"
}

dependencies {
        compile "dk.eobjects.commons:MetaModel:1.0.7"
}

task myTask << {
        configurations.testRuntime.each { file -> println file }
}

P.S. You don't need to quote the task name any more when creating it.

Could you create a test case and file a Jira?

- Hans

Re: NPE when using exclude rules

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 26, 2009, at 9:38 PM, Rafael Serrano wrote:

>
> Hi Hans,
>
> Thanks for the quick reply. I over-simplified my use case and that  
> example
> works, but I have just found the problem and it comes when using a  
> flatDir
> resolver. Here is a failing script:
> repositories {
> flatDir name: 'lib', dirs: "src/lib"
>    mavenCentral().checkconsistency = false
> }
>
> configurations {
> all*.exclude group: "hsqldb"
> }
>
> dependencies {
> compile "dk.eobjects.commons:MetaModel:1.0.7"
> compile ":gdata-core:1.0"
> }
>
> task myTask << {
> configurations.testRuntime.each { file -> println file }
> }
>
> The problem seem to be that I can't reference any library with an  
> empty
> group, so I have changed my dependency to:
> compile "a:gdata-core:1.0"
> and moved accordingly my JAR to "src/lib/a/gdata-core". This  
> workaround is
> working for me, but anyway I'm gonna post a JIRA on this.
>
> Thanks for your help. Regards
> Rafa

I'm pretty sure that this is related to the fixed (in trunk) issue: http://jira.codehaus.org/browse/GRADLE-499 
. But I haven't tried it yet.

It would be awesome if you could use the latest snapshot and give it a  
try (http://gradle.org/snapshots.html).

- Hans

>
>
>
> hdockter wrote:
>>
>> Hi Rafa,
>>
>> I can't reproduce this. The following code works for me (MetaModel  
>> has
>> a dependency on hsqldb):
>>
>> usePlugin 'java'
>>
>> repositories {
>> mavenCentral()
>> }
>>
>> configurations {
>>   all*.exclude group: "hsqldb"
>> }
>>
>> dependencies {
>> compile "dk.eobjects.commons:MetaModel:1.0.7"
>> }
>>
>> task myTask << {
>> configurations.testRuntime.each { file -> println file }
>> }
>>
>> P.S. You don't need to quote the task name any more when creating it.
>>
>> Could you create a test case and file a Jira?
>>
>> - Hans
>>
>>
>
> --
> View this message in context: http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23729882.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by Rafael Serrano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've tried the latest snapshot I've seen (gradle-0.6-20090520111850+1000-all.zip) and doesn't work either (still getting the NPE).

Now I'm downloading the source code from the repository to give it a try.

Thanks
Rafa

hdockter wrote:
On May 26, 2009, at 9:38 PM, Rafael Serrano wrote:

>
> Hi Hans,
>
> Thanks for the quick reply. I over-simplified my use case and that  
> example
> works, but I have just found the problem and it comes when using a  
> flatDir
> resolver. Here is a failing script:
> repositories {
> flatDir name: 'lib', dirs: "src/lib"
>    mavenCentral().checkconsistency = false
> }
>
> configurations {
> all*.exclude group: "hsqldb"
> }
>
> dependencies {
> compile "dk.eobjects.commons:MetaModel:1.0.7"
> compile ":gdata-core:1.0"
> }
>
> task myTask << {
> configurations.testRuntime.each { file -> println file }
> }
>
> The problem seem to be that I can't reference any library with an  
> empty
> group, so I have changed my dependency to:
> compile "a:gdata-core:1.0"
> and moved accordingly my JAR to "src/lib/a/gdata-core". This  
> workaround is
> working for me, but anyway I'm gonna post a JIRA on this.
>
> Thanks for your help. Regards
> Rafa

I'm pretty sure that this is related to the fixed (in trunk) issue: http://jira.codehaus.org/browse/GRADLE-499 
. But I haven't tried it yet.

It would be awesome if you could use the latest snapshot and give it a  
try (http://gradle.org/snapshots.html).

- Hans

>
>
>
> hdockter wrote:
>>
>> Hi Rafa,
>>
>> I can't reproduce this. The following code works for me (MetaModel  
>> has
>> a dependency on hsqldb):
>>
>> usePlugin 'java'
>>
>> repositories {
>> mavenCentral()
>> }
>>
>> configurations {
>>   all*.exclude group: "hsqldb"
>> }
>>
>> dependencies {
>> compile "dk.eobjects.commons:MetaModel:1.0.7"
>> }
>>
>> task myTask << {
>> configurations.testRuntime.each { file -> println file }
>> }
>>
>> P.S. You don't need to quote the task name any more when creating it.
>>
>> Could you create a test case and file a Jira?
>>
>> - Hans
>>
>>
>
> --
> View this message in context: http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23729882.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: NPE when using exclude rules

by Rafael Serrano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep,

As you said it seems that my issue was related to that of GRADLE-499 and the latest version of gradle in the trunk (Gradle 0.7-20090527130725+0200) is working perfectly.

Thanks a lot for your help
Rafa

Re: NPE when using exclude rules

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rafa,

On May 27, 2009, at 1:28 PM, Rafael Serrano wrote:

>
> Yep,
>
> As you said it seems that my issue was related to that of GRADLE-499  
> and the
> latest version of gradle in the trunk (Gradle  
> 0.7-20090527130725+0200) is
> working perfectly.

many thanks for trying this out.

- Hans

>
> Thanks a lot for your help
> Rafa
>
> --
> View this message in context: http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23740592.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by LightGuard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://issues.apache.org/jira/browse/IVY-983  It's fixed in trunk now
thankfully.

Jason Porter
Real Programmers think better when playing Adventure or Rogue.

PGP key id: 926CCFF5
PGP fingerprint: 64C2 C078 13A9 5B23 7738 F7E5 1046 C39B 926C CFF5
PGP key available at: keyserver.net, pgp.mit.edu



On Tue, May 26, 2009 at 12:58, Hans Dockter <mail@...> wrote:

>
> On May 26, 2009, at 8:45 PM, Jason Porter wrote:
>
>> How is this working with Ivy?  AFAIK this is broken in Ivy.
>
> Not that I know off. What exactly do you mean is broken? The whole Ivy
> exclude mechanism?
>
> - Hans
>
>>
>>
>> Jason Porter
>> Real Programmers think better when playing Adventure or Rogue.
>>
>> PGP key id: 926CCFF5
>> PGP fingerprint: 64C2 C078 13A9 5B23 7738 F7E5 1046 C39B 926C CFF5
>> PGP key available at: keyserver.net, pgp.mit.edu
>>
>>
>>
>> On Tue, May 26, 2009 at 12:38, Hans Dockter <mail@...> wrote:
>>>
>>> Hi Rafa,
>>>
>>> I can't reproduce this. The following code works for me (MetaModel has a
>>> dependency on hsqldb):
>>>
>>> usePlugin 'java'
>>>
>>> repositories {
>>>       mavenCentral()
>>> }
>>>
>>> configurations {
>>>  all*.exclude group: "hsqldb"
>>> }
>>>
>>> dependencies {
>>>       compile "dk.eobjects.commons:MetaModel:1.0.7"
>>> }
>>>
>>> task myTask << {
>>>       configurations.testRuntime.each { file -> println file }
>>> }
>>>
>>> P.S. You don't need to quote the task name any more when creating it.
>>>
>>> Could you create a test case and file a Jira?
>>>
>>> - Hans
>>>
>>> On May 26, 2009, at 8:11 PM, Rafael Serrano wrote:
>>>
>>>>
>>>> Hi all,
>>>>
>>>> I am currently migrating from 0.5 to 0.6 and have almost succeeded
>>>> (thanks
>>>> to the breaking changes doc) except for the exclusion of transitive
>>>> dependencies. Actually, I'm getting a NPE when I try to iterate over the
>>>> files in a configuration.
>>>>
>>>> Here is a code snippet:
>>>> configurations {
>>>>  all*.exclude group: "hsqldb"
>>>> }
>>>> dependencies {
>>>>  compile "a-jar-that-depends-on-hsqldb"
>>>> }
>>>> task "myTask" << {
>>>>       configurations.testRuntime.each { file -> println file }
>>>> }
>>>>
>>>> Is this really a bug or am I doing something wrong? In case it is a bug,
>>>> could you please think of a workaround?
>>>>
>>>> Thanks in advance. Regards
>>>> Rafa
>>>>
>>>> PS: In case it helps, here is the stacktrace
>>>> Execution failed for task ':myTask'.
>>>>       at
>>>> org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:183)
>>>>       at
>>>>
>>>>
>>>> org.gradle.execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:153)
>>>>       at
>>>>
>>>>
>>>> org.gradle.execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:144)
>>>>       at
>>>>
>>>>
>>>> org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
>>>>       at
>>>>
>>>>
>>>> org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:88)
>>>>       at org.gradle.Gradle.runInternal(Gradle.java:121)
>>>>       at org.gradle.Gradle.run(Gradle.java:93)
>>>>       at org.gradle.Main.execute(Main.java:253)
>>>>       at org.gradle.Main.main(Main.java:83)
>>>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>       at java.lang.reflect.Method.invoke(Method.java:597)
>>>>       at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
>>>> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver.resolveAsReport(DefaultIvyDependencyResolver.java:72)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyService.resolveAsReportInternal(DefaultIvyService.java:120)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyService.resolveAsReport(DefaultIvyService.java:110)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveAsReport(DefaultConfiguration.java:156)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolve(DefaultConfiguration.java:147)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:175)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.AbstractFileCollection.iterator(AbstractFileCollection.java:48)
>>>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>       at java.lang.reflect.Method.invoke(Method.java:597)
>>>>       at
>>>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>>>       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>>>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>>>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.asIterator(InvokerHelper.java:506)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1056)
>>>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>       at java.lang.reflect.Method.invoke(Method.java:597)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)
>>>>       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>>>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>>>>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>>>       at build_gradle$_run_closure13.doCall(build_gradle:202)
>>>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>       at
>>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>       at java.lang.reflect.Method.invoke(Method.java:597)
>>>>       at
>>>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>>>       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
>>>>       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:778)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
>>>>       at
>>>>
>>>>
>>>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>>>>       at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy:94)
>>>>       at org.gradle.api.ClosureTaskAction.execute(DefaultTask.groovy)
>>>>       at
>>>> org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:219)
>>>>       at
>>>> org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:174)
>>>>       ... 13 common frames omitted
>>>> Caused by: java.lang.NullPointerException
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.plugins.matcher.ExactPatternMatcher$ExactMatcher.matches(ExactPatternMatcher.java:46)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:34)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:38)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.plugins.matcher.MatcherHelper.matches(MatcherHelper.java:49)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.doesExclude(DefaultModuleDescriptor.java:627)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.core.resolve.IvyNodeCallers.doesExclude(IvyNodeCallers.java:288)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:269)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.core.resolve.IvyNodeCallers.doesCallersExclude(IvyNodeCallers.java:251)
>>>>       at
>>>> org.apache.ivy.core.resolve.IvyNode.getArtifacts(IvyNode.java:830)
>>>>       at
>>>>
>>>> org.apache.ivy.core.resolve.IvyNode.getSelectedArtifacts(IvyNode.java:739)
>>>>       at
>>>>
>>>>
>>>> org.apache.ivy.core.report.ResolveReport.setDependencies(ResolveReport.java:235)
>>>>       at
>>>>
>>>> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:236)
>>>>       at org.apache.ivy.Ivy.resolve(Ivy.java:512)
>>>>       at
>>>>
>>>>
>>>> org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver.resolveAsReport(DefaultIvyDependencyResolver.java:68)
>>>>       ... 59 common frames omitted
>>>> --
>>>> View this message in context:
>>>>
>>>> http://www.nabble.com/NPE-when-using-exclude-rules-tp23728395p23728395.html
>>>> Sent from the gradle-user mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>  http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>
>>> --
>>> Hans Dockter
>>> Gradle Project Manager
>>> http://www.gradle.org
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>  http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
> --
> Hans Dockter
> Gradle Project Manager
> http://www.gradle.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 2, 2009, at 7:26 AM, Jason Porter wrote:

> http://issues.apache.org/jira/browse/IVY-983  It's fixed in trunk now
> thankfully.

Thanks for pointing this out. The fix for the issue has not made it  
into the 2.1 branch yet. We are also waiting on another fix to be  
merged.

But the examples we present in http://gradle.org/0.6.1/docs/userguide/dependency_management.html#sec 
:how_to_declare_your_dependencies do work. They are validated by our  
SamplesExcludesAndClassifiersIntegrationTest.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by LightGuard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Which bug is that Hans?

I am also a little curious how it's working in Gradle if it doesn't
work in Ivy core?  Are we stopping the usage of the core API before
this bug shows up?

Jason Porter
Real Programmers think better when playing Adventure or Rogue.

PGP key id: 926CCFF5
PGP fingerprint: 64C2 C078 13A9 5B23 7738 F7E5 1046 C39B 926C CFF5
PGP key available at: keyserver.net, pgp.mit.edu



On Wed, Jun 3, 2009 at 02:11, Hans Dockter <mail@...> wrote:

>
> On Jun 2, 2009, at 7:26 AM, Jason Porter wrote:
>
>> http://issues.apache.org/jira/browse/IVY-983  It's fixed in trunk now
>> thankfully.
>
> Thanks for pointing this out. The fix for the issue has not made it into the
> 2.1 branch yet. We are also waiting on another fix to be merged.
>
> But the examples we present in
> http://gradle.org/0.6.1/docs/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
> do work. They are validated by our
> SamplesExcludesAndClassifiersIntegrationTest.
>
> - Hans
>
> --
> Hans Dockter
> Gradle Project Manager
> http://www.gradle.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: NPE when using exclude rules

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 3, 2009, at 6:17 PM, Jason Porter wrote:

> Which bug is that Hans?

http://jira.codehaus.org/browse/GRADLE-415 which is caused by https://issues.apache.org/jira/browse/IVY-1066 
.

>
> I am also a little curious how it's working in Gradle if it doesn't
> work in Ivy core?  Are we stopping the usage of the core API before
> this bug shows up?

No. Our examples and test only check for exclusion of transitive  
dependencies. I was aware that exclusions are not applied to first  
level dependencies and thought that this is intentional :).

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email