Coming at this from the stack trace, the line in the NPE refers to this
line (at least in my 12/15 source):
if (!fileValue.getParentFile().isDirectory() &&
!fileValue.getParentFile().mkdirs()) {
One immediately jumps to the conclusion that fileValue must be null but
I would note that fileValue can be both valid and an actual file and
getParentFile() might still return null if the abstract path has never
been resolved. The fact that immediately above that there is another
check that accesses methods on fileValue without throwing exceptions
tends to support that idea.
I would normally change these to
fileValue.getCanonicalFile().getParentFile() since that forces path
resolution to an actual file.
I point all of this out because generally, I only see the lack of a
parent file when the File() itself doesn't contain any path parts, ie:
File( "foo.zip" ) versus File( "build/foo.zip" ). The former will
return null from getParentFile() the latter not usually.
So, is there something about your build setup that has altered how the
zip task's target file is constructed?
I think this is a gradle bug anyway and the code should probably be
modified as above, but I'm still hoping the info helps you resolve your
immediate problem.
-Paul
Russel Winder wrote:
Working by analogy with what is in Gradle's build.gradle -- which I
assume actually works -- I tried:
task srcZip ( type : Zip , description : 'Create the zip file of the
source.' ) {
classifier = 'src'
into ( gantPrefix ) { from ( projectDir ) { include 'src/' } }
}
However it always gives the result below, i.e. doesn't work and doesn't
give back any useful information. Is anyone able to interpret the
reason why this isn't working for me?
Execution failed for task ':srcZip'.
at
org.gradle.api.internal.tasks.DefaultTaskExecuter.executeActions(DefaultTaskExecuter.java:64)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.tasks.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:42)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.project.ExecutionShortCircuitTaskExecuter.execute(ExecutionShortCircuitTaskExecuter.java:63)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.tasks.SkipTaskExecuter.doExecute(SkipTaskExecuter.java:61)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.tasks.SkipTaskExecuter.execute(SkipTaskExecuter.java:35)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:206)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:167)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:160)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:78)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:160)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.execution.DelegatingBuildExecuter.execute(DelegatingBuildExecuter.java:54)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.GradleLauncher.doBuildStages(GradleLauncher.java:199)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.GradleLauncher.doBuild(GradleLauncher.java:133)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.GradleLauncher.run(GradleLauncher.java:103)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.launcher.Main.execute(Main.java:93)
[gradle-launcher-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.launcher.Main.main(Main.java:42)
[gradle-launcher-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at org.gradle.launcher.GradleMain.main(GradleMain.java:51)
[gradle-launcher-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
Caused by: java.lang.NullPointerException: null
at
org.gradle.api.internal.project.OutputFilePropertyAnnotationHandler$1.validate(OutputFilePropertyAnnotationHandler.java:37)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.project.AnnotationProcessingTaskFactory$Validator.execute(AnnotationProcessingTaskFactory.java:208)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.project.AnnotationProcessingTaskFactory$Validator.execute(AnnotationProcessingTaskFactory.java:177)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
at
org.gradle.api.internal.tasks.DefaultTaskExecuter.executeActions(DefaultTaskExecuter.java:56)
[gradle-core-0.9-20091217075908+0000.jar:0.9-20091217075908+0000]
... 16 common frames omitted
12:50:17.447 [main] ERROR org.gradle.launcher.Main -
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email