Russel Winder wrote:
Paul,

Thanks for you support in sorting this out -- I suspect I might have
twigged it . . .

On Thu, 2009-12-17 at 09:33 -0500, Paul Speed wrote:
In case it matters as far as evidence collection, when it worked for me I only had a handful of files in the src/ directory as I created it just for the test. My real src directory is elsewhere.

It may also be important to note that prior to creating this src/ directory the zip task would never run since it considered itself up to date.

I think it turns out that the actual content might have been a red
herring . . .

I never saw an NPE in any of my testing so it's either a problem with a later build than what I have or your environment somehow.

I think that every example in the user guide of using Tar or Zip does so
in the context of using the Java plugin and that the Java plugin somehow
sets the default directory for all Tar and Zip tasks.

By default the destinationDir property of Tar and Zip tasks is empty
which means null and hence NPE.

Incidentally, Hans's comments not withstanding, the syntax below is incorrect for your intent, I think since there is nothing associating the into( 'test' ) with any from()s. When I tried the blow (which worked, by the way) it produced a zip with only the files and no src or test subdirectories.

Just at the minute . . . pass :-)

I had been using whatever it was in the Gradle build -- which I had
assumed did what it was meant and implied to do -- perhaps it doesn't.

Anyway, now that I know that destinationDir has to be set explicitly
when outside the context of a Java plugin scope I can at least try some
experiment to see what doe and doesn't work.

At least I have escaped NPE :-)

The error message is fundamentally poor.  Well rubbish really.


Email that passes in the night... as I had pretty much come to this conclusion too. :)

I don't have time to create a Jira issue for this at the moment but the fix is to change or put a line in front of: if (!fileValue.getParentFile().isDirectory() && !fileValue.getParentFile().mkdirs()) {

Personally, I'd stick in a:
fileValue = fileValue.getCanonicalFile();

...ahead of that check. It will fix the NPE and you would have noticed your zip getting created where you are running gradle... probably a more obvious outcome than an NPE for missing destination directory. :)

-Paul


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

   http://xircles.codehaus.org/manage_email


Reply via email to