Resolve root directory in a multi-project build

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Resolve root directory in a multi-project build

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.
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Tamás Cservenák
Howdy,
Grab somehow (you did not state from where if "outside of plugins")
MavenSession, it has getExecutionRootDirectory method, BUT it may not be
what you want, as one may use -f param for example...

So, I'd shoot back: WHY do you need the root of a multi module build and
FROM WHAT you need it? Extension?
Are you sure you can expect maven is invoked from root? Could it be simpler
just to pass in as some parameter maybe, instead of doing all sorts of
hoops and loops?

T

On Fri, Feb 5, 2021 at 5:04 PM Andres Almiray <[hidden email]> wrote:

> 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.
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Lasse Lindqvist
Using directory-maven-plugin and highest-basedir goal from it has worked
just fine for me.
https://github.com/jdcasey/directory-maven-plugin#highest-basedir-goal

pe 5. helmik. 2021 klo 18.53 Tamás Cservenák ([hidden email])
kirjoitti:

> Howdy,
> Grab somehow (you did not state from where if "outside of plugins")
> MavenSession, it has getExecutionRootDirectory method, BUT it may not be
> what you want, as one may use -f param for example...
>
> So, I'd shoot back: WHY do you need the root of a multi module build and
> FROM WHAT you need it? Extension?
> Are you sure you can expect maven is invoked from root? Could it be simpler
> just to pass in as some parameter maybe, instead of doing all sorts of
> hoops and loops?
>
> T
>
> On Fri, Feb 5, 2021 at 5:04 PM Andres Almiray <[hidden email]> wrote:
>
> > 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.
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Andres Almiray
@Tamás: Right, should had explained the use case. I want to deploy all
artifacts to a local directory so that I can inspect everything which will
be deployed given certain conditions.
I managed to do that by forcing a stable, absolute directory as shown at

https://github.com/moditect/layrry/pull/90/commits/93472049fee1b5ffa579929211aac20bef3f5e00

I'd prefer if the target directory be ${rootProject.build.directory} if
there were such things as {$rootProject}, which is why I'm asking for a way
to find out that value.
As you may appreciate in that commit the value is used as part of
<distributionManagement> in a profile.

@Lasse: I thought using that plugin would work but not in my case as the
computed property is not available during model interpolation which is my
case for setting the correct value in <distributionManagement>

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.


On Fri, Feb 5, 2021 at 6:32 PM Lasse Lindqvist <[hidden email]>
wrote:

> Using directory-maven-plugin and highest-basedir goal from it has worked
> just fine for me.
> https://github.com/jdcasey/directory-maven-plugin#highest-basedir-goal
>
> pe 5. helmik. 2021 klo 18.53 Tamás Cservenák ([hidden email])
> kirjoitti:
>
> > Howdy,
> > Grab somehow (you did not state from where if "outside of plugins")
> > MavenSession, it has getExecutionRootDirectory method, BUT it may not be
> > what you want, as one may use -f param for example...
> >
> > So, I'd shoot back: WHY do you need the root of a multi module build and
> > FROM WHAT you need it? Extension?
> > Are you sure you can expect maven is invoked from root? Could it be
> simpler
> > just to pass in as some parameter maybe, instead of doing all sorts of
> > hoops and loops?
> >
> > T
> >
> > On Fri, Feb 5, 2021 at 5:04 PM Andres Almiray <[hidden email]>
> wrote:
> >
> > > 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.
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Tamás Cservenák
Unsure will it help, but your description reminded me of nexus-staging
plugin, there we similarly "deploy locally" (defer actual deploy) to fire
the deployables at the project end:
https://github.com/sonatype/nexus-maven-plugins/blob/master/staging/maven-plugin/src/main/java/org/sonatype/nexus/maven/staging/deploy/strategy/DeferredDeployStrategy.java

Is quite messy plugin :)

For example as "location" for the files we use "first module that has THIS
plugin defined" as it is "stable" enough (and we do not quite care where
the files are accumulated):
https://github.com/sonatype/nexus-maven-plugins/blob/master/staging/maven-plugin/src/main/java/org/sonatype/nexus/maven/staging/AbstractStagingMojo.java#L423

Hope this helps
T

On Fri, Feb 5, 2021 at 6:52 PM Andres Almiray <[hidden email]> wrote:

> @Tamás: Right, should had explained the use case. I want to deploy all
> artifacts to a local directory so that I can inspect everything which will
> be deployed given certain conditions.
> I managed to do that by forcing a stable, absolute directory as shown at
>
>
> https://github.com/moditect/layrry/pull/90/commits/93472049fee1b5ffa579929211aac20bef3f5e00
>
> I'd prefer if the target directory be ${rootProject.build.directory} if
> there were such things as {$rootProject}, which is why I'm asking for a way
> to find out that value.
> As you may appreciate in that commit the value is used as part of
> <distributionManagement> in a profile.
>
> @Lasse: I thought using that plugin would work but not in my case as the
> computed property is not available during model interpolation which is my
> case for setting the correct value in <distributionManagement>
>
> 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.
>
>
> On Fri, Feb 5, 2021 at 6:32 PM Lasse Lindqvist <
> [hidden email]>
> wrote:
>
> > Using directory-maven-plugin and highest-basedir goal from it has worked
> > just fine for me.
> > https://github.com/jdcasey/directory-maven-plugin#highest-basedir-goal
> >
> > pe 5. helmik. 2021 klo 18.53 Tamás Cservenák ([hidden email])
> > kirjoitti:
> >
> > > Howdy,
> > > Grab somehow (you did not state from where if "outside of plugins")
> > > MavenSession, it has getExecutionRootDirectory method, BUT it may not
> be
> > > what you want, as one may use -f param for example...
> > >
> > > So, I'd shoot back: WHY do you need the root of a multi module build
> and
> > > FROM WHAT you need it? Extension?
> > > Are you sure you can expect maven is invoked from root? Could it be
> > simpler
> > > just to pass in as some parameter maybe, instead of doing all sorts of
> > > hoops and loops?
> > >
> > > T
> > >
> > > On Fri, Feb 5, 2021 at 5:04 PM Andres Almiray <[hidden email]>
> > wrote:
> > >
> > > > 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.
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Falko Modler
In reply to this post by Andres Almiray
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

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, <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Falko Modler
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, <[hidden email]> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Alexander Kriegisch-2
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, <[hidden email]> 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: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Delany
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.
Delany

On Sat, 6 Feb 2021 at 04:22, Alexander Kriegisch <[hidden email]>
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, <[hidden email]> 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: [hidden email]
> >>> For additional commands, e-mail: [hidden email]
> >>>
> >>>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Alexander Kriegisch-2
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 <[hidden email]>
> 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, <[hidden email]> 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: [hidden email]
>> >>> For additional commands, e-mail: [hidden email]
>> >>>
>> >>>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Delany
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 <[hidden email]> 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 <[hidden email]>
> 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, <[hidden email]> 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: [hidden email]
>> >>> For additional commands, e-mail: [hidden email]
>> >>>
>> >>>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

location.zip (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

michaelo
In reply to this post by Andres Almiray
Am 2021-02-05 um 18:52 schrieb Andres Almiray:
> @Tamás: Right, should had explained the use case. I want to deploy all
> artifacts to a local directory so that I can inspect everything which will
> be deployed given certain conditions.
> I managed to do that by forcing a stable, absolute directory as shown at
>
> https://github.com/moditect/layrry/pull/90/commits/93472049fee1b5ffa579929211aac20bef3f5e00

This will not work in the future anymore:
https://issues.apache.org/jira/browse/MNG-7047


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Alexander Kriegisch-2
In reply to this post by Delany
> 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 <[hidden email]
> <mailto:[hidden email]> > 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
>> <[hidden email]
>> <mailto:[hidden email]> >
>> > 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, <[hidden email]
>> <mailto:[hidden email]> > 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: [hidden email]
>> <mailto:[hidden email]>
>> >> >>> For additional commands, e-mail: [hidden email]
>> <mailto:[hidden email]>
>> >> >>>
>> >> >>>
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: [hidden email]
>> <mailto:[hidden email]>
>> >> > For additional commands, e-mail: [hidden email]
>> <mailto:[hidden email]>
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [hidden email]
>> <mailto:[hidden email]>
>> >> For additional commands, e-mail: [hidden email]
>> <mailto:[hidden email]>
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> <mailto:[hidden email]>
>> For additional commands, e-mail: [hidden email]
>> <mailto:[hidden email]>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Delany
Hopefully our conversation will benefit others who've experienced the same
issue, so thank you for showing that it works in some cases. I think the
reason someone might want their projects all in the same directory is
because Eclipse has issues with nested project structures.

@Lasse, the directory-of goal of directory-maven-plugin seems even more
idiot-proof than highest-basedir, so im using that.

Delany

On Sun, 7 Feb 2021 at 03:29, Alexander Kriegisch <[hidden email]>
wrote:

> > 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 <
> [hidden email]
> > <mailto:[hidden email]> > 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
> >> <[hidden email]
> >> <mailto:[hidden email]> >
> >> > 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, <[hidden email]
> >> <mailto:[hidden email]> > 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: [hidden email]
> >> <mailto:[hidden email]>
> >> >> >>> For additional commands, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >> >> >>>
> >> >> >>>
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >> >> > For additional commands, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >> >> For additional commands, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >> For additional commands, e-mail: [hidden email]
> >> <mailto:[hidden email]>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Alexander Kriegisch-2
> I think the reason someone might want their projects all in the same
> directory is because Eclipse has issues with nested project
> structures.

I see how that can be a pain in the ***. I was unaware of this problem,
being an IntelliJ IDEA user.

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


Delany schrieb am 07.02.2021 12:19 (GMT +07:00):

> Hopefully our conversation will benefit others who've experienced the same
> issue, so thank you for showing that it works in some cases. I think the
> reason someone might want their projects all in the same directory is
> because Eclipse has issues with nested project structures.
>
> @Lasse, the directory-of goal of directory-maven-plugin seems even more
> idiot-proof than highest-basedir, so im using that.
>
> Delany
>
> On Sun, 7 Feb 2021 at 03:29, Alexander Kriegisch <[hidden email]>
> wrote:
>
>> > 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 <
>> [hidden email]
>> > <mailto:[hidden email]> > 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
>> >> <[hidden email]
>> >> <mailto:[hidden email]> >
>> >> > 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, <[hidden email]
>> >> <mailto:[hidden email]> > 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: [hidden email]
>> >> <mailto:[hidden email]>
>> >> >> >>> For additional commands, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >> >> >>>
>> >> >> >>>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >> >> > For additional commands, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >> >> For additional commands, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >> >>
>> >> >>
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >> For additional commands, e-mail: [hidden email]
>> >> <mailto:[hidden email]>
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Delany
Following on a bit, I logged this ticket
https://github.com/pascalgn/properties-maven-extension/issues/58
so the property *git.dir.worktree* is available before the reactor starts.
But now I've found a situation that even an extension can't help with:

Suppose I want to utilise an alternative settings.xml file. I can place it
in .mvn/settings.xml and add --settings=.mvn/settings.xml to
.mvn/maven.config

But this only works when I build from the highest basedir. No property is
yet available to say --settings=${highest-basedir}/.mvn/settings.xml

And yet Maven was clearly able to find the .mvn directory. So if we can
take that as the highest-basedir, it just remains to give that location a
name and make it available.

Anyone see any issues with this?

Thanks,

On Mon, 8 Feb 2021 at 07:35, Alexander Kriegisch <[hidden email]>
wrote:

> > I think the reason someone might want their projects all in the same
> > directory is because Eclipse has issues with nested project
> > structures.
>
> I see how that can be a pain in the ***. I was unaware of this problem,
> being an IntelliJ IDEA user.
>
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Delany schrieb am 07.02.2021 12:19 (GMT +07:00):
>
> > Hopefully our conversation will benefit others who've experienced the
> same
> > issue, so thank you for showing that it works in some cases. I think the
> > reason someone might want their projects all in the same directory is
> > because Eclipse has issues with nested project structures.
> >
> > @Lasse, the directory-of goal of directory-maven-plugin seems even more
> > idiot-proof than highest-basedir, so im using that.
> >
> > Delany
> >
> > On Sun, 7 Feb 2021 at 03:29, Alexander Kriegisch <
> [hidden email]>
> > wrote:
> >
> >> > 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 <
> >> [hidden email]
> >> > <mailto:[hidden email]> > 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
> >> >> <[hidden email]
> >> >> <mailto:[hidden email]> >
> >> >> > 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, <[hidden email]
> >> >> <mailto:[hidden email]> > 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: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> >> >>> For additional commands, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> ---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> >> > For additional commands, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> >> For additional commands, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> >>
> >> >> >>
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >> For additional commands, e-mail: [hidden email]
> >> >> <mailto:[hidden email]>
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Andres Almiray
Interesting. Given that Maven 4 will include the wrapper; wrapper files are kept at $ROOT/.mvn; running a wrapper from a child project requires that $ROOt/.mvn be known (from the outside even). Thus the value of the top most basedir can be guaranteed.

Of course this works only if there is a .mvn dir at the top. Hoping that will be the common case in the future, could we have a way to expose that dir by default as soon as Maven boots up? Fall back to a warning when the directory is not found.

Thoughts?

Sent from my primitive tricorder

> On 18 Feb 2021, at 14:15, Delany <[hidden email]> wrote:
>
> Following on a bit, I logged this ticket
> https://github.com/pascalgn/properties-maven-extension/issues/58
> so the property *git.dir.worktree* is available before the reactor starts.
> But now I've found a situation that even an extension can't help with:
>
> Suppose I want to utilise an alternative settings.xml file. I can place it
> in .mvn/settings.xml and add --settings=.mvn/settings.xml to
> .mvn/maven.config
>
> But this only works when I build from the highest basedir. No property is
> yet available to say --settings=${highest-basedir}/.mvn/settings.xml
>
> And yet Maven was clearly able to find the .mvn directory. So if we can
> take that as the highest-basedir, it just remains to give that location a
> name and make it available.
>
> Anyone see any issues with this?
>
> Thanks,
>
> On Mon, 8 Feb 2021 at 07:35, Alexander Kriegisch <[hidden email]>
> wrote:
>
>>> I think the reason someone might want their projects all in the same
>>> directory is because Eclipse has issues with nested project
>>> structures.
>>
>> I see how that can be a pain in the ***. I was unaware of this problem,
>> being an IntelliJ IDEA user.
>>
>> --
>> Alexander Kriegisch
>> https://scrum-master.de
>>
>>
>> Delany schrieb am 07.02.2021 12:19 (GMT +07:00):
>>
>>> Hopefully our conversation will benefit others who've experienced the
>> same
>>> issue, so thank you for showing that it works in some cases. I think the
>>> reason someone might want their projects all in the same directory is
>>> because Eclipse has issues with nested project structures.
>>>
>>> @Lasse, the directory-of goal of directory-maven-plugin seems even more
>>> idiot-proof than highest-basedir, so im using that.
>>>
>>> Delany
>>>
>>> On Sun, 7 Feb 2021 at 03:29, Alexander Kriegisch <
>> [hidden email]>
>>> wrote:
>>>
>>>>> 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 <
>>>> [hidden email]
>>>>> <mailto:[hidden email]> > 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
>>>>>> <[hidden email]
>>>>>> <mailto:[hidden email]> >
>>>>>>> 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, <[hidden email]
>>>>>> <mailto:[hidden email]> > 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: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>> <mailto:[hidden email]>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Resolve root directory in a multi-project build

Hervé BOUTEMY
In reply to this post by Andres Almiray
I wrote a doc for deploying to local staging directory [1] in Maven Deploy Plugin documentation (not yet released)

perhaps this can be of use

Regards,

Hervé

[1] https://maven.apache.org/plugins-archives/maven-deploy-plugin-LATEST/examples/deploy-network-issues.html

Le vendredi 5 février 2021, 18:52:09 CET Andres Almiray a écrit :

> @Tamás: Right, should had explained the use case. I want to deploy all
> artifacts to a local directory so that I can inspect everything which will
> be deployed given certain conditions.
> I managed to do that by forcing a stable, absolute directory as shown at
>
> https://github.com/moditect/layrry/pull/90/commits/93472049fee1b5ffa57992921
> 1aac20bef3f5e00
>
> I'd prefer if the target directory be ${rootProject.build.directory} if
> there were such things as {$rootProject}, which is why I'm asking for a way
> to find out that value.
> As you may appreciate in that commit the value is used as part of
> <distributionManagement> in a profile.
>
> @Lasse: I thought using that plugin would work but not in my case as the
> computed property is not available during model interpolation which is my
> case for setting the correct value in <distributionManagement>
>
> 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.
>
>
> On Fri, Feb 5, 2021 at 6:32 PM Lasse Lindqvist <[hidden email]>
> wrote:
> > Using directory-maven-plugin and highest-basedir goal from it has worked
> > just fine for me.
> > https://github.com/jdcasey/directory-maven-plugin#highest-basedir-goal
> >
> > pe 5. helmik. 2021 klo 18.53 Tamás Cservenák ([hidden email])
> >
> > kirjoitti:
> > > Howdy,
> > > Grab somehow (you did not state from where if "outside of plugins")
> > > MavenSession, it has getExecutionRootDirectory method, BUT it may not be
> > > what you want, as one may use -f param for example...
> > >
> > > So, I'd shoot back: WHY do you need the root of a multi module build and
> > > FROM WHAT you need it? Extension?
> > > Are you sure you can expect maven is invoked from root? Could it be
> >
> > simpler
> >
> > > just to pass in as some parameter maybe, instead of doing all sorts of
> > > hoops and loops?
> > >
> > > T
> > >
> > > On Fri, Feb 5, 2021 at 5:04 PM Andres Almiray <[hidden email]>
> >
> > wrote:
> > > > 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: [hidden email]
For additional commands, e-mail: [hidden email]