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

rootlocation does not correctly work #48

Closed
khmarbaise opened this issue Apr 18, 2017 · 11 comments · Fixed by #92
Closed

rootlocation does not correctly work #48

khmarbaise opened this issue Apr 18, 2017 · 11 comments · Fixed by #92
Assignees
Labels
Milestone

Comments

@khmarbaise
Copy link
Member

Using the rootlocation in a multi module build and having a sub module which contains rootlocation.

Calling mvn like this:

mvn -pl submodule package

Does not seemed to work correctly.

@khmarbaise khmarbaise added the bug label Apr 18, 2017
@khmarbaise khmarbaise modified the milestones: 3.1.0, 3.0.1 Apr 18, 2017
@nadilas
Copy link

nadilas commented Jun 24, 2017

Did you mean this issue by that?

[INFO] Processing change of org.identifier:SubModule:1.0.139-SNAPSHOT -> 1.0.140-SNAPSHOT
[DEBUG] Applying change null:SubMlodule:1.0.139-SNAPSHOT -> 1.0.140-SNAPSHOT
[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project SubModule: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.2:set failed. NullPointerException -> [Help 1]

@khmarbaise
Copy link
Member Author

This is related to versions-maven-plugin. Apart from that you are referencing a very old version. This issue of the versions-maven-plugin has already been fixed with version 2.4...

tmcsantos added a commit to tmcsantos/build-helper-maven-plugin that referenced this issue Dec 4, 2019
tmcsantos added a commit to tmcsantos/build-helper-maven-plugin that referenced this issue Dec 4, 2019
tmcsantos added a commit to tmcsantos/build-helper-maven-plugin that referenced this issue Dec 9, 2019
@kriegaex
Copy link

kriegaex commented May 31, 2020

This issue has been open for more than 3 years, the rootlocation goal is useless in multi-module builds (and in single-module builds nobody needs it). Is anything wrong with PR #48? Can someone please review it, then merge and/or manually fix the problem and release a new version? That would be wonderful.

BTW, it is not just mvn -pl submodule package being problematic, but e.g. also in IntelliJ IDEA when double-clicking on a goal or phase in a sub-module, it runs the build with

java -Dmaven.multiModuleProjectDirectory=/path/to/submodule (...) verify

which means that I cannot use ${maven.multiModuleProjectDirectory} (which is meant for internal use only anyway according to some a comment by @khmarbaise on StackOverflow), so if I do need a path relative to the project root in order to e.g. run tests with Java agents build in some sub-modules and used in others, a relative path from one module to the other just won't do in all situations because it depends from which module directory I run a build. I will never understand why Maven does not expose the project root directory as a core feature, but at least if this would work I could use the Build Helper.


Update: Just as a related background info why it would be nice to get this feature fixed, here are the problems I have with maven.multiModuleProjectDirectory in IntelliJ IDEA:

@stefanseifert stefanseifert self-assigned this Jun 2, 2020
@stefanseifert
Copy link
Collaborator

i'll take a look. the ITs do not run on windows, but that should be fixed easily.

stefanseifert added a commit that referenced this issue Jun 2, 2020
- maven is executed on a submodule
- projects aggregation root and parent is not the same
- child modules may reside in deeper nested folders without a pom.xml in between
@stefanseifert
Copy link
Collaborator

the PR #84 is not sufficient - it works only when the parent pom = aggregation root pom. if you have a parent that is a child pom separate from the aggregation root pom it returns the path of the parent pom which is not the intention.

i've created a new PR #92 which should work in all cases.
@kriegaex @tmcsantos can you verify that the PR works in your scenarios as well?

@kriegaex
Copy link

kriegaex commented Jun 2, 2020

A quick test indicates that this seems to work from the command line, unless when I am running any tests based on it from IntelliJ IDEA, either via Maven from the IDE or directly by running tests from there. But that is of course not a problem in the plugin but IDEA's inability to recognise and import the variable from the goal.

I did not do a thorough test with different types of projects and situations, just some builds from both root directory and from a sub-module directory with the default settings for the goal. It seems to be working nicely now. Before it was not working at all.

I am not an expert in Maven or this plugin, but you get my thumbs up.

I think @khmarbaise is much more qualified to tell if this is as it should be for all cases, including edge ones.

@kriegaex
Copy link

kriegaex commented Jun 2, 2020

Oh, I forgot a detail: The build in your branch runs with version number 3.1.0-SNAPSHOT, but 3.1.0 is the current release already. Should it not rather be 3.1.1-SNAPSHOT then?

@kriegaex
Copy link

kriegaex commented Jun 3, 2020

OMG, I just noticed why I had the wrong snapshot version: I accidentally built and tested the original PR, not the improved one. Yours links to the original and I just clicked the wrong link in order to get to the repository to clone from. GitHub really should provide a direct clone URL right from the PR without having to navigate first.

Your PR also works for me, but I did not test against a project where the aggregator POM is not the project parent POM at the same time. I trust you did that.

stefanseifert added a commit that referenced this issue Jun 8, 2020
Fixes #48 rootlocation does not correctly work
kriegaex added a commit to SarekTest/Sarek that referenced this issue Jun 18, 2020
… version

Waiting for version 3.2.0 being uploaded to Maven Central after bugfix for
mojohaus/build-helper-maven-plugin#48
@kriegaex
Copy link

Quick question: Yesterday you released the new version 3.2.0, but it still is unavailable on Maven Central. Usually my experience when releasing to Central is that it does not take that long to be published. Did you maybe forget to deploy the artifact?

@stefanseifert
Copy link
Collaborator

it's under voting process which takes at least 72h - see mail thread
if no objection is raised it's published to maven central when the voting is completed.

@kriegaex
Copy link

Oh, of course. Stupid me! This is OSS with a release process, not my private project which I can push to Maven Central anytime.

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

Successfully merging a pull request may close this issue.

4 participants