Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.1
    • Component/s: Testing
    • Labels:
      None
    • Environment:
      Maven 2.2.1

      Description

      Testing fails with Maven 2.2.1 with the following commands as noted in [1]

      $mvn install -P init
      $mvn install
      $mvn jetspeed:mvn -Dtarget=testdb
      $export MAVEN_OPTS="-Xmx128m -XX:MaxPermSize=128m"
      $mvn -e jetspeed:mvn -Dtarget=test

      [1] http://portals.apache.org/jetspeed-2/buildguide/maven-2-build.html

      The exception message is like this:

      --------------

      --------------

      [INFO] ------------------------------------------------------------------------
      [INFO] Building Jetspeed-2 RDBMS Components
      [INFO] task-segment: [test]
      [INFO] ------------------------------------------------------------------------
      [INFO] [remote-resources:process

      {execution: default}

      ]
      [INFO] [resources:resources

      {execution: default-resources}

      ]
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /home/johndoe/workspace/jetspeed-2/components/jetspeed-rdbms/src/main/resources
      [INFO] Copying 0 resource
      [INFO] Copying 3 resources
      [INFO] [compiler:compile

      {execution: default-compile}

      ]
      [INFO] Nothing to compile - all classes are up to date
      [INFO] [resources:testResources

      {execution: default-testResources}

      ]
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /home/johndoe/workspace/jetspeed-2/components/jetspeed-rdbms/src/test/resources
      [INFO] Copying 1 resource
      [INFO] Copying 3 resources
      [INFO] [jetspeed-unpack:unpack

      {execution: unpack-test-resources}

      ]
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error while unpacking /home/johndoe/workspace/jetspeed-2/jetspeed-portal-resources/target/classes

      Embedded error: /home/johndoe/workspace/jetspeed-2/jetspeed-portal-resources/target/classes (Is a directory)
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Error while unpacking /home/johndoe/workspace/jetspeed-2/jetspeed-portal-resources/target/classes
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      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)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error while unpacking /home/johndoe/workspace/jetspeed-2/jetspeed-portal-resources/target/classes
      at org.apache.jetspeed.maven.utils.UnpackResources.unpack(UnpackResources.java:501)
      at org.apache.jetspeed.maven.mojo.AbstractUnpackMojo.execute(AbstractUnpackMojo.java:54)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      ... 17 more
      Caused by: java.io.FileNotFoundException: /home/johndoe/workspace/jetspeed-2/jetspeed-portal-resources/target/classes (Is a directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(FileInputStream.java:106)
      at org.apache.jetspeed.maven.utils.UnpackResources.unpack(UnpackResources.java:397)
      ... 20 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 19 seconds
      [INFO] Finished at: Fri Apr 02 11:25:03 CEST 2010
      [INFO] Final Memory: 38M/65M
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] ...FAILED[code=1].
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.BuildFailureException: ...FAILED[code=1].
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      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)
      Caused by: org.apache.maven.plugin.MojoFailureException: ...FAILED[code=1].
      at org.apache.jetspeed.maven.plugins.MvnMojo.executeTarget(MvnMojo.java:517)
      at org.apache.jetspeed.maven.plugins.MvnMojo.execute(MvnMojo.java:339)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      ... 17 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 28 seconds
      [INFO] Finished at: Fri Apr 02 11:25:03 CEST 2010
      [INFO] Final Memory: 25M/51M
      [INFO] ------------------------------------------------------------------------

        Activity

        Hide
        Woonsan Ko added a comment -

        Here's a suggested solution from Ate:

        """
        The change which Maven 2.2.1 seems to have introduced (and thinking of it: I kind of agree with that change as an improvement) is that when running multi-project builds, sub module builds will always get to see the most recent dependent artifacts created within their own project.
        This means that you always will see local changes from other sub modules instead of just the most recent installed ones.
        When you run a multi-project test goal, no artifacts will be installed, only build locally, and therefore Maven has to resort to providing a Artifact wrapper around those artifact build target folders, instead of possibly out-dated or even if at all installed jars.

        Bottom line, this is not "fixable" anymore through pom configurations or something as this now is core behavior from Maven itself.

        As it is, this means the unpack plugin(s) are now broken with Maven 2.2.1+ if you want to use them within during test goal execution.

        I think the only sensible solution is to fix this within the org.apache.jetspeed.maven.utils.UnpackResources.unpack method.
        Currently it only can handle zip/jar files which is why this error is thrown.
        The processing of the zip/jar archive contents is done by iterating through it using a ZipInputStream.
        I think it should be not a big problem to abstract that to support both zip/jar archives or a file system folder (meaning folder/file iteration), but it will take some time (but not too much) to write that.
        """

        Show
        Woonsan Ko added a comment - Here's a suggested solution from Ate: """ The change which Maven 2.2.1 seems to have introduced (and thinking of it: I kind of agree with that change as an improvement) is that when running multi-project builds, sub module builds will always get to see the most recent dependent artifacts created within their own project. This means that you always will see local changes from other sub modules instead of just the most recent installed ones. When you run a multi-project test goal, no artifacts will be installed, only build locally, and therefore Maven has to resort to providing a Artifact wrapper around those artifact build target folders, instead of possibly out-dated or even if at all installed jars. Bottom line, this is not "fixable" anymore through pom configurations or something as this now is core behavior from Maven itself. As it is, this means the unpack plugin(s) are now broken with Maven 2.2.1+ if you want to use them within during test goal execution. I think the only sensible solution is to fix this within the org.apache.jetspeed.maven.utils.UnpackResources.unpack method. Currently it only can handle zip/jar files which is why this error is thrown. The processing of the zip/jar archive contents is done by iterating through it using a ZipInputStream. I think it should be not a big problem to abstract that to support both zip/jar archives or a file system folder (meaning folder/file iteration), but it will take some time (but not too much) to write that. """
        Hide
        Woonsan Ko added a comment -

        Fixed.

        Added an abstracted file entry collection to support both zip file and folder.

        Show
        Woonsan Ko added a comment - Fixed. Added an abstracted file entry collection to support both zip file and folder.

          People

          • Assignee:
            Woonsan Ko
            Reporter:
            Woonsan Ko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development