Maven Archetype
  1. Maven Archetype
  2. ARCHETYPE-355

NPE in DefaultArchetypeArtifactManager.closeZipFile when running integration-test goal

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: Plugin
    • Labels:
      None
    • Environment:
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      After successfully creating an archetype from a project (using archetype:create-from-project), a NullPointerException is encountered when executing the "integration-test" goal of the archetype plugin. The steps to reproduce are:

      cd /tmp
      svn co https://squirrel-sql.svn.sourceforge.net/svnroot/squirrel-sql/trunk/sql12/plugins/example example
      cd example
      mvn -X clean install > build.log
      mvn -X archetype:create-from-project > archetype-create.log
      cd /tmp/example/target/generated-sources/archetype
      mvn -X -e archetype:integration-test > archetype-test.log

      The NullPointerException is listed at the bottom of /tmp/example/target/generated-sources/archetype/archetype-test.log and appears as follows:

      Caused by: java.lang.NullPointerException
              at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.closeZipFile(DefaultArchetypeArtifactManager.java:588)
              at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.isFileSetArchetype(DefaultArchetypeArtifactManager.java:200)
              at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.generateArchetype(DefaultArchetypeGenerator.java:104)
              at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.generateArchetype(DefaultArchetypeGenerator.java:149)
              at org.apache.maven.archetype.mojos.IntegrationTestMojo.processIntegrationTest(IntegrationTestMojo.java:237)
              at org.apache.maven.archetype.mojos.IntegrationTestMojo.execute(IntegrationTestMojo.java:108)
              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)

      The attached zip file contains all of the logs that were generated. The source is available on the web with the svn checkout listed above for convenience.

        Activity

        Hide
        Herve Boutemy added a comment -

        you can't run archetype:integration-test directly: it is expected to be run in a build lifecycle, which builds the archetype artifact just before trying to use it

        run 'mvn integration-test' and you'll see that everything is ok

        BTW, I updated the goals' documentation, added a check and more useful error message in r1163363: I suppose you won't be the only one trying to do this (that's not a stupid try, after all)

        Show
        Herve Boutemy added a comment - you can't run archetype:integration-test directly: it is expected to be run in a build lifecycle, which builds the archetype artifact just before trying to use it run 'mvn integration-test' and you'll see that everything is ok BTW, I updated the goals' documentation, added a check and more useful error message in r1163363 : I suppose you won't be the only one trying to do this (that's not a stupid try, after all)
        Hide
        Nico De Groote added a comment - - edited

        Not solved in 2.1 version.
        When running 'crawl' goal on my machine to update my local archetype file I do get this mistake again.
        When running with last version 2.2-SNASPHOT, the issue is in fact solved...

        D:\development\eclipse-workspaces\provikmo-archetypes\root>mvn clean org.apache.maven.plugins:maven-archetype-plugin:2.
        :crawl
        [INFO] Scanning for projects...
        [INFO] ------------------------------------------------------------------------
        [INFO] Building Root Archetypes
        [INFO] task-segment: [clean]
        [INFO] ------------------------------------------------------------------------
        [INFO] [clean:clean

        {execution: default-clean}

        ]
        [INFO] ------------------------------------------------------------------------
        [INFO] Building Root Archetypes
        [INFO] task-segment: [org.apache.maven.plugins:maven-archetype-plugin:2.1:crawl] (aggregator-style)
        [INFO] ------------------------------------------------------------------------
        [INFO] [archetype:crawl

        {execution: default-cli}

        ]
        repository D:\development\.m2\repository
        catalogFile null
        [INFO] Scanning D:\development\.m2\repository\acegisecurity\acegi-security\1.0.1\acegi-security-1.0.1.jar
        [INFO] Scanning D:\development\.m2\repository\ant\ant\1.5\ant-1.5.jar
        [INFO] Scanning D:\development\.m2\repository\ant\ant\1.5.1\ant-1.5.1.jar
        [INFO] Scanning D:\development\.m2\repository\ant\ant\1.6\ant-1.6.jar
        [INFO] Scanning D:\development\.m2\repository\ant\ant\1.6.2\ant-1.6.2-javadoc.jar
        [INFO] ------------------------------------------------------------------------
        [ERROR] FATAL ERROR
        [INFO] ------------------------------------------------------------------------
        [INFO] null
        [INFO] ------------------------------------------------------------------------
        [INFO] Trace
        java.lang.NullPointerException
        at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.closeZipFile(DefaultArchetypeArtifactManag
        r.java:588)
        at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.isFileSetArchetype(DefaultArchetypeArtifac
        Manager.java:200)
        at org.apache.maven.archetype.repositorycrawler.DefaultRepositoryCrawler.crawl(DefaultRepositoryCrawler.java:72

        at org.apache.maven.archetype.mojos.CrawlRepositoryMojo.execute(CrawlRepositoryMojo.java:70)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        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.ja
        a: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: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: 2 minutes 58 seconds
        [INFO] Finished at: Thu Oct 13 11:27:33 CEST 2011
        [INFO] Final Memory: 21M/51M
        [INFO] ------------------------------------------------------------------------

        Show
        Nico De Groote added a comment - - edited Not solved in 2.1 version. When running 'crawl' goal on my machine to update my local archetype file I do get this mistake again. When running with last version 2.2-SNASPHOT, the issue is in fact solved... D:\development\eclipse-workspaces\provikmo-archetypes\root>mvn clean org.apache.maven.plugins:maven-archetype-plugin:2. :crawl [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Root Archetypes [INFO] task-segment: [clean] [INFO] ------------------------------------------------------------------------ [INFO] [clean:clean {execution: default-clean} ] [INFO] ------------------------------------------------------------------------ [INFO] Building Root Archetypes [INFO] task-segment: [org.apache.maven.plugins:maven-archetype-plugin:2.1:crawl] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [archetype:crawl {execution: default-cli} ] repository D:\development\.m2\repository catalogFile null [INFO] Scanning D:\development\.m2\repository\acegisecurity\acegi-security\1.0.1\acegi-security-1.0.1.jar [INFO] Scanning D:\development\.m2\repository\ant\ant\1.5\ant-1.5.jar [INFO] Scanning D:\development\.m2\repository\ant\ant\1.5.1\ant-1.5.1.jar [INFO] Scanning D:\development\.m2\repository\ant\ant\1.6\ant-1.6.jar [INFO] Scanning D:\development\.m2\repository\ant\ant\1.6.2\ant-1.6.2-javadoc.jar [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] null [INFO] ------------------------------------------------------------------------ [INFO] Trace java.lang.NullPointerException at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.closeZipFile(DefaultArchetypeArtifactManag r.java:588) at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.isFileSetArchetype(DefaultArchetypeArtifac Manager.java:200) at org.apache.maven.archetype.repositorycrawler.DefaultRepositoryCrawler.crawl(DefaultRepositoryCrawler.java:72 at org.apache.maven.archetype.mojos.CrawlRepositoryMojo.execute(CrawlRepositoryMojo.java:70) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694) 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.ja a: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: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: 2 minutes 58 seconds [INFO] Finished at: Thu Oct 13 11:27:33 CEST 2011 [INFO] Final Memory: 21M/51M [INFO] ------------------------------------------------------------------------

          People

          • Assignee:
            Herve Boutemy
            Reporter:
            Rob Manning
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: