NPE when filtering fileSet
--------------------------

                 Key: MASSEMBLY-342
                 URL: http://jira.codehaus.org/browse/MASSEMBLY-342
             Project: Maven 2.x Assembly Plugin
          Issue Type: Bug
         Environment: Windows XP, cygwin, Java 1.5.0.9
            Reporter: Peter Verhás


I get NPE when I specify filtering in an assembly descriptor. The 
{{src/assembly/bin.xml}} file (referenced by the {{pom.xml}} as an assembly 
descriptor) is the following:

{code}
<assembly>
        <id>bin</id>

        <formats>
                <format>zip</format>
        </formats>

        <includeBaseDirectory>false</includeBaseDirectory>

        <dependencySets>
                <dependencySet>
                        <outputDirectory>lib</outputDirectory>
                </dependencySet>
        </dependencySets>

        <fileSets>
                <fileSet>
                        <directory>target</directory>
                        <outputDirectory></outputDirectory>
                        <includes>
                                <include>*.jar</include>
                        </includes>
                </fileSet>
                <fileSet>
                        <filtered>true</filtered>
                        <includes>
                                <include>INSTALL*</include>
                                <include>README*</include>
                                <include>LICENSE*</include>
                                <include>NOTICE*</include>
                        </includes>
                </fileSet>
        </fileSets>

</assembly>
{code}

This causes

{code}
$ mvn -e assembly:assembly
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'assembly'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - verhas.com:isoapui8583:jar:1.0.0
[INFO]    task-segment: [assembly:assembly] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing assembly:assembly
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - verhas.com:isoapui8583:jar:1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: 
http://repo1.maven.org/maven2/xmlbeans/xbean/2.3.0-trunk-patched/xbean-2.3.0-trunk-patched.pom
Downloading: 
http://repo1.maven.org/maven2/groovy/groovy-all/1.5.2/groovy-all-1.5.2.pom
Downloading: 
http://repo1.maven.org/maven2/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom
Downloading: 
http://repo1.maven.org/maven2/cweb-extser/cweb-extser/0.1-b2-dev/cweb-extser-0.1-b2-dev.pom
Downloading: 
http://repo1.maven.org/maven2/jPOS/jpos/1.6.2-r2626/jpos-1.6.2-r2626.pom
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: 
p:\projects\BASE24-soapui\BICISO-SOAPUI\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.verhas.soapui.jpos.TestServer
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.078 sec
Running com.verhas.soapui.jpos.TestClient
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Running com.verhas.soapui.jpos.TestClientServer
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec
Running com.verhas.soapui.jpos.TestConstants
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
[INFO] Building jar: 
p:\projects\BASE24-soapui\BICISO-SOAPUI\target\isoapui8583-1.0.0.jar
[INFO] [assembly:assembly]
[INFO] Reading assembly descriptor: src/assembly/doc.xml
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] Reading assembly descriptor: src/assembly/src.xml
[INFO] Building zip: 
p:\projects\BASE24-soapui\BICISO-SOAPUI\target\isoapui8583-1.0.0-doc.zip
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at java.io.File.<init>(File.java:222)
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.scan(FileSetManager.java:598)
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.getIncludedFiles(FileSetManager.java:186)
        at 
org.apache.maven.plugin.assembly.format.FileSetFormatter.formatFileSetForAssembly(FileSetFormatter.java:67)
        at 
org.apache.maven.plugin.assembly.archive.task.AddFileSetsTask.addFileSet(AddFileSetsTask.java:133)
        at 
org.apache.maven.plugin.assembly.archive.task.AddFileSetsTask.execute(AddFileSetsTask.java:87)
        at 
org.apache.maven.plugin.assembly.archive.phase.FileSetAssemblyPhase.execute(FileSetAssemblyPhase.java:54)
        at 
org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:129)
        at 
org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:322)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:227)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53 seconds
[INFO] Finished at: Fri Jul 18 13:04:38 CEST 2008
[INFO] Final Memory: 11M/22M
[INFO] ------------------------------------------------------------------------
{code}

The workaround is to move the {{INSTALL.txt}} file into the {{resources}} 
directory and have filtered during resource filtering, and to modify the 
assembly description to copy the file {{INSTALL.txt}} from the 
{{target/classes}} directory to the root of the ZIP file. But this is far from 
ideal. INSTALL.txt is *not* a resource and this way happens to be twice in the 
release (one in the ZIP file and once in the JAR being in the ZIP).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to