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


Reply via email to