jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Maven 2.x Assembly Plugin
  • Maven 2.x Assembly Plugin
  • MASSEMBLY-342

NPE when filtering fileSet

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.2-beta-3
  • Component/s: None
  • Labels:
    None
  • Environment:
    Windows XP, cygwin, Java 1.5.0.9
  • Number of attachments :
    2

Description

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:

<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>

This causes

$ 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] ------------------------------------------------------------------------

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).

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    massembly-342.txt
    25/Aug/08 2:35 PM
    1 kB
    Petar Tahchiev
  2. Hide
    Zip Archive
    massembly-342.zip
    04/Sep/08 7:05 AM
    1 kB
    Petar Tahchiev
    1. Text File
      massembly-342.txt 1 kB
    2. Text File
      massembly-342-it.txt 3 kB
    Download Zip
    Show
    Zip Archive
    massembly-342.zip
    04/Sep/08 7:05 AM
    1 kB
    Petar Tahchiev

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. MASSEMBLY-297 Assembly broke on GNU/Linux - NullPointerException

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
relates to

Bug - A problem which impairs or prevents the functions of the product. MSHARED-55 NLP IF no fileset directory specified.

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Petar Tahchiev added a comment - 25/Aug/08 2:35 PM

Hi Peter,

I agree this is a bug. You can easily escape getting the exception if you specify the <directory> parameter in the fileset, like this:

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

As you can see I have specified the . directory.
I have created a patch which should be applied to the FileSetManager in maven-file-management. It first checks if a directory parameter is specified and if not, it simply produces a message that you have to specify a parameter.

HTH, Petar.

Show
Petar Tahchiev added a comment - 25/Aug/08 2:35 PM Hi Peter, I agree this is a bug. You can easily escape getting the exception if you specify the <directory> parameter in the fileset, like this: <fileSet> <directory>.</directory> <filtered>true</filtered> <includes> <include>INSTALL*</include> <include>README*</include> <include>LICENSE*</include> <include>NOTICE*</include> </includes> </fileSet> </fileSets> As you can see I have specified the . directory. I have created a patch which should be applied to the FileSetManager in maven-file-management. It first checks if a directory parameter is specified and if not, it simply produces a message that you have to specify a parameter. HTH, Petar.
Hide
Permalink
Petar Tahchiev added a comment - 25/Aug/08 2:35 PM

Here is the patch.

Show
Petar Tahchiev added a comment - 25/Aug/08 2:35 PM Here is the patch.
Hide
Permalink
Wendy Smoak added a comment - 25/Aug/08 2:45 PM

That means this fix will require a release of Maven Shared – unless someone is planning one soon, we might want to move this issue out to beta-4 to avoid delaying beta-3.

Show
Wendy Smoak added a comment - 25/Aug/08 2:45 PM That means this fix will require a release of Maven Shared – unless someone is planning one soon, we might want to move this issue out to beta-4 to avoid delaying beta-3.
Hide
Permalink
Petar Tahchiev added a comment - 25/Aug/08 3:56 PM

This issue is the same as MASSEMBLY-297.

Show
Petar Tahchiev added a comment - 25/Aug/08 3:56 PM This issue is the same as MASSEMBLY-297 .
Hide
Permalink
Petar Tahchiev added a comment - 04/Sep/08 7:04 AM

OK,

after discussing this with the Maved SHARED team, we agreed that this is more a Maven Assembly issue. So I will attach a zip containing a new patch and integration-tests.

Show
Petar Tahchiev added a comment - 04/Sep/08 7:04 AM OK, after discussing this with the Maved SHARED team, we agreed that this is more a Maven Assembly issue. So I will attach a zip containing a new patch and integration-tests.
Hide
Permalink
Petar Tahchiev added a comment - 04/Sep/08 7:05 AM

Here is the zip file with the new patch and the integration-tests.

Show
Petar Tahchiev added a comment - 04/Sep/08 7:05 AM Here is the zip file with the new patch and the integration-tests.
Hide
Permalink
John Casey added a comment - 04/Sep/08 11:42 AM

applied, thanks.

Show
John Casey added a comment - 04/Sep/08 11:42 AM applied, thanks.

People

  • Assignee:
    John Casey
    Reporter:
    Peter Verhás
Vote (0)
Watch (1)

Dates

  • Created:
    18/Jul/08 6:10 AM
    Updated:
    04/Sep/08 11:42 AM
    Resolved:
    04/Sep/08 11:42 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.