> It seems the goal assumes that child modules sit in nested
> directories.

Well, that might be the case. I have never tested any other scenario
because this is how I organise my Maven projects. Neither am I a Maven
expert nor did I claim that my solution works for everybody in every
case. I just read a message on the list, remembered that I used to
struggle with a similar problem in the past and offered my solution
because it *works for me*. If it does not work for you because your
child modules are not in nested directories, I am sorry. I am more the
"convention over configuration" type, trying to keep it simple.

Regards
-- 
Alexander Kriegisch
https://scrum-master.de


Delany schrieb am 06.02.2021 21:07 (GMT +07:00):
> 
> 
> It seems the goal assumes that child modules sit in nested directories.
> 
> Unzip and run mvn validate in the root directory, and you'll see the root
> location for project sarek is incorrect.
> 
> Delany
> 
> 
> On Sat, 6 Feb 2021 at 14:28, Alexander Kriegisch <alexan...@kriegisch.name
> <mailto:alexan...@kriegisch.name> > wrote:
> 
>> Maybe I misunderstand you, but for me this works nicely in a module which
>> has a parent of type POM which has the root (also of type POM) as parent.
>> I.e. the root POM is the grandparent. I have no issues, as long as the
>> property is declared in the root as shown in the project I linked to.
>> --
>> Alexander Kriegisch
>> https://scrum-master.de
>> 
>> 
>> Delany schrieb am 06.02.2021 17:24 (GMT +07:00):
>> 
>> > This only works if the parent is the root. If you extend to a third
>> level
>> > of pom, it will report the rootlocation as the project directory.
>> >
>> > On Sat, 6 Feb 2021 at 04:22, Alexander Kriegisch
>> <alexan...@kriegisch.name
>> <mailto:alexan...@kriegisch.name> >
>> > wrote:
>> >
>> >> I had some discussion with Karl Heinz Marbaise about
>> >> maven.multiModuleProjectDirectory a while ago (cannot remember where
>> >> exactly) and he strongly advised me not to use it as it is for
>> internal
>> >> use only. Even so, other tools such as IntelliJ IDEA use it
>> internally,
>> >> but not consequently, the situationis a bit messy.
>> >>
>> >> What I ended up doing was to use Build Helper Maven Plugin >= 3.2.0
>> >> (because of
>> >>
>> https://github.com/mojohaus/build-helper-maven-plugin/issues/48)
>> and
>> >> there to use the "rootlocation" goal. I am not sure if that is working
>> >> for you here because you said you need it somewhere in a plugin and I
>> >> just use it in my project's root POM. For IDEA I still need need
>> >> "-DprojectRootDir=..." in <projectRootDir>/.mvn/jvm.config, but from
>> the
>> >> command line it works, even when building from a module subdirectory.
>> >> Here is my POM (just search for the string "rootlocation" there, you
>> >> should find 4 places):
>> >>
>> >> https://github.com/SarekTest/Sarek/blob/master/pom.xml
>> >> --
>> >> Alexander Kriegisch
>> >> https://scrum-master.de
>> >>
>> >>
>> >> Falko Modler schrieb am 06.02.2021 04:35 (GMT +07:00):
>> >>
>> >> > For me, no problem on Jenkins either (using "withMaven" pipeline
>> step).
>> >> > There used to be this issue:
>> >> https://issues.jenkins.io/browse/JENKINS-35335
>> >> > Which turned out to be a Maven bug which was fixed in 3.5.0:
>> >> > https://issues.apache.org/jira/browse/MNG-5889
>> >> >
>> >> > As far as MNG-5830 is concerned, I don't know what (special) setup
>> the
>> >> > affected people are using.
>> >> >
>> >> > I can only say/repeat that you need a .mvn directory to have the
>> >> > property point to your root directory.
>> >> > But even without .mvn, there should not be such an error message, so
>> IDK
>> >> > what's going on in those cases.
>> >> >
>> >> > Am 05.02.2021 um 22:13 schrieb Delany:
>> >> >> Maybe for you Falko, but not my Jenkins server with Maven 3.6.3, or
>> >> these
>> >> >> other users
>> >> >>
>> https://issues.apache.org/jira/plugins/servlet/mobile#issue/MNG-5830
>> >> >> Delany
>> >> >>
>> >> >>
>> >> >> On Fri, 5 Feb 2021, 22:25 Falko Modler, <f.mod...@gmx.net
>> <mailto:f.mod...@gmx.net> > wrote:
>> >> >>
>> >> >>> I've been using maven.multiModuleProjectDirectory in various
>> projects
>> >> >>> (and have also seen it in others).
>> >> >>> You'll need a .mvn directory in your root directory to make it
>> work.
>> >> >>>
>> >> >>> PS: I know that there has been some controvery about this property
>> but
>> >> >>> well, it works! ;-)
>> >> >>>
>> >> >>> Cheers,
>> >> >>> Falko
>> >> >>>
>> >> >>> Am 05.02.2021 um 17:03 schrieb Andres Almiray:
>> >> >>>> Hello everyone,
>> >> >>>>
>> >> >>>> Is there a way to reliably resolve the value of the root
>> directory
>> >> for a
>> >> >>>> given multi-project build?
>> >> >>>> Unfortunately ${session.executionRootDirectory} does not seem to
>> work
>> >> for
>> >> >>>> all cases, it might work when used inside a plugin's
>> <configuration>
>> >> >>>> section but does not when used outside of plugins
>> >> >>>>
>> >> >>>> TIA
>> >> >>>>
>> >> >>>> Cheers,
>> >> >>>> Andres
>> >> >>>>
>> >> >>>> -------------------------------------------
>> >> >>>> Java Champion; Groovy Enthusiast
>> >> >>>> http://andresalmiray.com
>> >> >>>> http://www.linkedin.com/in/aalmiray
>> >> >>>> --
>> >> >>>> What goes up, must come down. Ask any system administrator.
>> >> >>>> There are 10 types of people in the world: Those who understand
>> >> binary,
>> >> >>> and
>> >> >>>> those who don't.
>> >> >>>> To understand recursion, we must first understand recursion.
>> >> >>>>
>> >> >>>
>> >> >>>
>> ---------------------------------------------------------------------
>> >> >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> <mailto:users-unsubscr...@maven.apache.org> 
>> >> >>> For additional commands, e-mail: users-h...@maven.apache.org
>> <mailto:users-h...@maven.apache.org> 
>> >> >>>
>> >> >>>
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> <mailto:users-unsubscr...@maven.apache.org> 
>> >> > For additional commands, e-mail: users-h...@maven.apache.org
>> <mailto:users-h...@maven.apache.org> 
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> <mailto:users-unsubscr...@maven.apache.org> 
>> >> For additional commands, e-mail: users-h...@maven.apache.org
>> <mailto:users-h...@maven.apache.org> 
>> >>
>> >>
>> >
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> <mailto:users-unsubscr...@maven.apache.org> 
>> For additional commands, e-mail: users-h...@maven.apache.org
>> <mailto:users-h...@maven.apache.org> 
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to