maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klemen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ARCHETYPE-531) NullPointerException when module not specified or config empty in EAR plugin
Date Fri, 01 Sep 2017 16:48:00 GMT
Klemen created ARCHETYPE-531:
--------------------------------

             Summary: NullPointerException when module not specified or config empty in EAR
plugin
                 Key: ARCHETYPE-531
                 URL: https://issues.apache.org/jira/browse/ARCHETYPE-531
             Project: Maven Archetype
          Issue Type: Bug
          Components: Creator
    Affects Versions: 3.0.1
            Reporter: Klemen


Missing <modules> tag in ear config causes null pointer. pom sample:

{code:java}
<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ear-plugin</artifactId>
                    <version>${ear.plugin}</version>
                    <configuration>
                        <version>7</version>
                        <fileNameMapping>no-version</fileNameMapping>
                    </configuration>
                </plugin>
...
{code}
Stacktrace after adding e.printStackTrace(); to FilesetArchetypeCreator, line 303:
{code:java}
java.lang.NullPointerException
	at org.apache.maven.archetype.creator.FilesetArchetypeCreator.rewriteEARPluginReferences(FilesetArchetypeCreator.java:721)
	at org.apache.maven.archetype.creator.FilesetArchetypeCreator.rewritePluginReferences(FilesetArchetypeCreator.java:712)
	at org.apache.maven.archetype.creator.FilesetArchetypeCreator.rewriteReferences(FilesetArchetypeCreator.java:619)
	at org.apache.maven.archetype.creator.FilesetArchetypeCreator.createArchetypePom(FilesetArchetypeCreator.java:908)
	at org.apache.maven.archetype.creator.FilesetArchetypeCreator.createPoms(FilesetArchetypeCreator.java:573)
	at org.apache.maven.archetype.creator.FilesetArchetypeCreator.createArchetype(FilesetArchetypeCreator.java:241)
	at org.apache.maven.archetype.DefaultArchetypeManager.createArchetypeFromProject(DefaultArchetypeManager.java:64)
	at org.apache.maven.archetype.mojos.CreateArchetypeFromProjectMojo.execute(CreateArchetypeFromProjectMojo.java:257)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

{code}

In same file on line 303, I believe catching any Exception and rethrowing a MojoFailureException
is not really helpful to anyone since it hides the actual cause and you have to dig deep into
the code to find it. At least it should be made more verbose. This is what is being thrown:

{code:java}
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:create-from-project
(default-cli) on project myproject-was: null
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException
	at org.apache.maven.archetype.mojos.CreateArchetypeFromProjectMojo.execute(CreateArchetypeFromProjectMojo.java:262)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
{code}

Similar reference form 2 years ago:
https://myshittycode.com/2015/08/05/maven-archetype-plugin-failed-to-execute-goal-org-apache-maven-pluginsmaven-archetype-plugin2-3create-from-project/





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message