Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-297

Assembly broke on GNU/Linux - NullPointerException

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 2.2-beta-1, 2.2-beta-2
    • None
    • None
    • None
    • $ mvn -version
      Maven version: 2.0.8
      Java version: 1.5.0_15
      OS name: "linux" version: "2.6.18-8.el5" arch: "amd64" Family: "unix"



    Description

      I have an assembly descriptor "src/main/assembly/unix.xml" which works on Windows but broke on Unix. When I commented out the following lines of the assembly descriptor then it worked on Unix:

      <fileSet>
      <includes>
      <include>README*</include>
      <include>LICENSE*</include>
      <include>NOTICE*</include>
      </includes>
      <filtered>true</filtered>
      </fileSet>

      I have no README*, LICENSE* or NOTICE* files in my src tree.

      I have no filters defined in my pom.xml. The <filtered>true</filtered> makes the assembly invoke filtering if the pom does define filters.

      With the above <fileSet> included in the <fileSets> element I get the following exception on assembly (on Unix only):

      (I had variously used lib and /lib as target directory when debugging this so ignore discrepencies in this regard)

      [INFO] Processing DependencySet (output=lib)
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] null
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      java.lang.NullPointerException
      at java.io.File.<init>(File.java:194)
      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:447)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:224)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
      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:585)
      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: 9 seconds
      [INFO] Finished at: Thu Mar 13 12:42:17 GMT 2008
      [INFO] Final Memory: 19M/470M
      [INFO] ------------------------------------------------------------------------

      Attachments

        1. buildlog.txt
          4 kB
          Robin Roos
        2. MASSEMBLY-297.zip
          3 kB
          Benjamin Bentmann
        3. unix.xml
          4 kB
          Robin Roos

        Issue Links

          Activity

            I got the maven-assembly-plugin:2.2-beta-2 failing on the attached mini project even on a Windows box. It works if either

            • using 2.2-beta-1 or
            • disabling filtering for the fileset in question

            Robin, can it be that you use auto-update for the plugins and that your tries on Windows simply used a different version of the plugin than on Unix?

            bentmann Benjamin Bentmann added a comment - I got the maven-assembly-plugin:2.2-beta-2 failing on the attached mini project even on a Windows box. It works if either using 2.2-beta-1 or disabling filtering for the fileset in question Robin, can it be that you use auto-update for the plugins and that your tries on Windows simply used a different version of the plugin than on Unix?

            could it be because the directory is not specified for this fileSet?

            jdcasey John Dennis Casey added a comment - could it be because the directory is not specified for this fileSet?

            could it be because the directory is not specified for this fileSet?

            Yes, at the end of the day, that's why the NPE comes up.

            However, leaving the directory unspecified is in general a supported use case. E.g. AddFileSetsTask.getFileSetDirectory() assumes the base directory in case the fileset's directory is not set, similar to ModuleSetAssemblyPhase.createFileSet().

            Seems the FileSetFormatter simply needs the same null check logic.

            bentmann Benjamin Bentmann added a comment - could it be because the directory is not specified for this fileSet? Yes, at the end of the day, that's why the NPE comes up. However, leaving the directory unspecified is in general a supported use case. E.g. AddFileSetsTask.getFileSetDirectory() assumes the base directory in case the fileset's directory is not set, similar to ModuleSetAssemblyPhase.createFileSet() . Seems the FileSetFormatter simply needs the same null check logic.

            Also fails in 2.2-beta-1 if using lineEnding on the file set (same code path). Additional sensitivity to filtering introducd by MASSEMBLY-154.

            bentmann Benjamin Bentmann added a comment - Also fails in 2.2-beta-1 if using lineEnding on the file set (same code path). Additional sensitivity to filtering introducd by MASSEMBLY-154 .
            paranoiabla Petar Tahchiev added a comment -

            Guys this issue is related to this one for the shared component. I have attached a patch there.

            paranoiabla Petar Tahchiev added a comment - Guys this issue is related to this one for the shared component. I have attached a patch there.

            wrong resolution

            jdcasey John Dennis Casey added a comment - wrong resolution

            People

              jdcasey John Dennis Casey
              robinroos2 Robin Roos
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: