Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'groupId' not always pulling from parent pom #5

Closed
roytruelove opened this issue Jul 14, 2015 · 11 comments
Closed

'groupId' not always pulling from parent pom #5

roytruelove opened this issue Jul 14, 2015 · 11 comments
Milestone

Comments

@roytruelove
Copy link

(with version 2.2)

Getting an NPE with the following (pretty standard) scenario using versions:set

In my remote repo (e.g. Artifactory) I've got a global parent pom (com.myco:global-parent-pom:pom.1.0-SNAPSHOT)

I then have a project:

+---myProject
    +--- pom.xml
    +--- moduleA
         +--- pom.xml
         +--- (etc)
    +--- moduleB
         +--- pom.xml
         +--- (etc)

myProject's parent pom references the 'global' parent pom as its parent:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

        <artifactId>my-project-pom</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <modelVersion>4.0.0</modelVersion>
        <packaging>pom</packaging>

        <parent>
                <groupId>com.myco</groupId>
                <artifactId>global-parent-pom</artifactId>
                <version>1.0-SNAPSHOT</version>
        </parent>

        <modules>
                <module>moduleA</module>
                <module>moduleB</module>
        </modules>

</project>

✨ Important - notice that I am not explicitly specifying a groupId for this pom since it should inherit from the parent (com.myco) ✨

moduleA and moduleB use myProject's pom as their parent. That's the setup - very standard.

When I run versions:set at the myProject level I get the following NPE stacktrace:

[DEBUG] Applying change null:my-project-pom:1.0.0-SNAPSHOT -> 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] moduleA ................................... FAILURE [  8.936 s]
[INFO] moduleB ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.818 s
[INFO] Finished at: 2015-07-14T12:35:50-04:00
[INFO] Final Memory: 13M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project droit-engine-pom: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project droit-engine-pom: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    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:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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.PluginExecutionException: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.NullPointerException
    at org.codehaus.mojo.versions.api.PomHelper.getModelEntry(PomHelper.java:1571)
    at org.codehaus.mojo.versions.SetMojo.applyChange(SetMojo.java:275)
    at org.codehaus.mojo.versions.SetMojo.execute(SetMojo.java:239)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    ... 20 more

Notice in the top line that the groupId is showing up as null.

Workaround

If I explicitly add the groupId (<groupId>com.myco</groupId>) to the root level of myProject's pom, it works.

tomerc added a commit to tomerc/versions-maven-plugin that referenced this issue Jul 16, 2015
tomerc added a commit to tomerc/versions-maven-plugin that referenced this issue Jul 16, 2015
tomerc added a commit to tomerc/versions-maven-plugin that referenced this issue Jul 17, 2015
'groupId' not always pulling from parent pom

'Fix mojohaus#5 groupId' not always pulling from parent pom - test case
tomerc added a commit to tomerc/versions-maven-plugin that referenced this issue Jul 19, 2015
'groupId' not always pulling from parent pom

'Fix mojohaus#5 groupId' not always pulling from parent pom - test case

'Fix mojohaus#5 groupId' not always pulling from parent pom

'groupId' not always pulling from parent pom

'Fix mojohaus#5 groupId' not always pulling from parent pom - test case
@khmarbaise khmarbaise added this to the 2.3 milestone Jul 24, 2015
@tonit
Copy link

tonit commented Nov 12, 2015

This looks still broke with release 2.2 (from august 2015):

[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project base: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project base: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)

Can anyone tell me want went wrong with the 2.2 timeline (bugfix in july, release in august)?
Any chance to get 2.3 out of the door? Just wondering ;)

@ghost
Copy link

ghost commented Dec 17, 2015

+1 - Still existing on Version 2.2

@csdcrussell
Copy link

Ran into this today on 2.2.

@carlobongiovanni
Copy link

It happened the same to me with 2.2 today.

@jxblum
Copy link

jxblum commented Jan 3, 2016

Still a problem with Maven version 3.3.9 and org.codehause.mojo:versions-maven-plugin:2.2.

$mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /Users/jblum/DEV/apache-maven-3.3.9
Java version: 1.8.0_66, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.2", arch: "x86_64", family: "mac"

Ran with...

$ mvn -e versions:set -DnewVersion=1.0.0.M1

Stack Trace...

[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project cp-elements: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project cp-elements: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed.
    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:497)
    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.PluginExecutionException: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: java.lang.NullPointerException
    at org.codehaus.mojo.versions.api.PomHelper.getModelEntry(PomHelper.java:1571)
    at org.codehaus.mojo.versions.SetMojo.applyChange(SetMojo.java:275)
    at org.codehaus.mojo.versions.SetMojo.execute(SetMojo.java:239)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 21 more

@jschneider
Copy link

Still a problem. Run in it today..

purple52 added a commit to CJSCommonPlatform/raml-maven that referenced this issue Mar 15, 2016
This serves two purposes:

1. Correctly groups artifacts instead of leaving them as top level.
2. Works around this bug: mojohaus/versions#5
purple52 added a commit to CJSCommonPlatform/raml-maven that referenced this issue Mar 15, 2016
This serves two purposes:

1. Correctly groups artifacts instead of leaving them as top level.
2. Works around this bug: mojohaus/versions#5
purple52 added a commit to CJSCommonPlatform/raml-maven that referenced this issue Mar 15, 2016
This serves two purposes:

1. Correctly groups artifacts instead of leaving them as top level.
2. Works around this bug: mojohaus/versions#5
@fripoli
Copy link

fripoli commented Jun 29, 2016

is there a roadmap for the release of 2.3 version with this fix?

@nishantmonu51
Copy link

Ran into it today, any release plans for fix ?

nishantmonu51 added a commit to nishantmonu51/druid that referenced this issue Jul 6, 2016
mvn -e versions:set -DnewVersion=<version> throws NPE with druid due to
mojohaus/versions#5
Setting groupId in parent pom as work around for it.
@nishantmonu51
Copy link

nishantmonu51 commented Jul 6, 2016

for anyone else running into it as a workaround - reverting the version to 2.1 worked for us.
mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DgenerateBackupPoms=false -DnewVersion=SOME_VERSION

@sgandon
Copy link

sgandon commented Jul 25, 2016

thanks for the workaround, any idea on when this shall be fixed ?

@ryan-williams
Copy link

Seems like it's fixed in version 2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests