You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laurian Angelescu <an...@gmail.com> on 2022/06/07 03:22:27 UTC

How to retrieve target folder / jar paths from multi-module Maven project

Is it possible to invoke *mvn* on the command line to output either 1) the
paths to all target folders where jars get packaged or 2) the file paths of
the jars themselves?

For example, in a multi-module project like
https://github.com/apache/httpcomponents-core.git, I would like to invoke:

*mvn <magic-parameters>*

and have output to standard out:

/<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
/<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
...
etc.

I want to essentially be able to get a list of the JARs created in *any *Maven
multimodule project.

Re: How to retrieve target folder / jar paths from multi-module Maven project

Posted by Tommy Svensson <to...@natusoft.se>.
On a unix system or Git Bash on Windows, cd to project root and do:

    find . -name \*.jar

If you need this automatically as part of the build process then it is a different thing. If so, consider writing a maven plugin for that. I doubt such already exists. If on a unix system only!, there might be a plugin available for executing external commands where the above find can be done. .

Regards,
Tommy Svensson

> 9 juni 2022 kl. 22:51 skrev Karl Heinz Marbaise <kh...@gmx.de>:
> 
> Hi,
> 
> On 07.06.22 05:22, Laurian Angelescu wrote:
>> Is it possible to invoke *mvn* on the command line to output either 1) the
>> paths to all target folders where jars get packaged or 2) the file paths of
>> the jars themselves?
>> 
>> For example, in a multi-module project like
>> https://github.com/apache/httpcomponents-core.git, I would like to invoke:
>> 
>> *mvn <magic-parameters>*
>> 
>> and have output to standard out:
>> 
>> /<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
>> /<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
>> ...
>> etc.
>> 
>> I want to essentially be able to get a list of the JARs created in *any *Maven
>> multimodule project.
>> 
> 
> Can you explain why you need those directory information? What kind of
> problem are you trying to solve?
> 
> Kind regards
> Karl Heinz Marbaise
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


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


Re: How to retrieve target folder / jar paths from multi-module Maven project

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 07.06.22 05:22, Laurian Angelescu wrote:
> Is it possible to invoke *mvn* on the command line to output either 1) the
> paths to all target folders where jars get packaged or 2) the file paths of
> the jars themselves?
>
> For example, in a multi-module project like
> https://github.com/apache/httpcomponents-core.git, I would like to invoke:
>
> *mvn <magic-parameters>*
>
> and have output to standard out:
>
> /<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
> /<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
> ...
> etc.
>
> I want to essentially be able to get a list of the JARs created in *any *Maven
> multimodule project.
>

Can you explain why you need those directory information? What kind of
problem are you trying to solve?

Kind regards
Karl Heinz Marbaise

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


Re: How to retrieve target folder or jar paths from multi-module Maven project

Posted by Delany <de...@gmail.com>.
That's what he wants.
The surest way is just to build the thing and `find */target -iname "*.jar"`
Need more info why its needed.

On Fri, 10 Jun 2022 at 08:40, Mantas Gridinas <mg...@gmail.com> wrote:

> Wouldn't the help plugin get executed for every module in the reactor and
> in turn output multiple build directories?
>
> On Fri, Jun 10, 2022, 09:04 Delany <de...@gmail.com> wrote:
>
> > Building on this, you could try this bash script. It is very slow
> >
> > while read -r pom; do mvn help:evaluate
> > -Dexpression=project.build.directory -q -DforceStdout -f $pom && echo;
> done
> > < <(find . -iname pom.xml)
> >
> >
> > On Thu, 9 Jun 2022 at 21:20, Bernd Eckenfels <ec...@zusammenkunft.net>
> > wrote:
> >
> > > The Maven Help Plugin has some functions, including printing evaluated
> > > project parameters.
> > >
> > >
> > > RESULT=$(mvn help:evaluate -Dexpression=project.version -q
> -DforceStdout)
> > >
> > > https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html
> > >
> > >
> > > --
> > > http://bernd.eckenfels.net
> > > ________________________________
> > > Von: Laurian Angelescu <an...@gmail.com>
> > > Gesendet: Tuesday, June 7, 2022 5:43:26 PM
> > > An: users@maven.apache.org <us...@maven.apache.org>
> > > Betreff: How to retrieve target folder or jar paths from multi-module
> > > Maven project
> > >
> > > Is it possible to invoke *mvn* on the command line to output either 1)
> > the
> > > paths to all target folders where jars get packaged or 2) the file
> paths
> > of
> > > the jars themselves?
> > >
> > > For example, in a multi-module project like
> > > https://github.com/apache/httpcomponents-core.git, I would like to
> > invoke:
> > >
> > > *mvn <magic-parameters>*
> > >
> > > and have output to standard out:
> > >
> > > /<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
> > > /<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
> > > ...
> > > etc.
> > >
> > > I want to essentially be able to get a list of the JARs created in *any
> > > *Maven
> > > multimodule project.
> > >
> >
>

Re: How to retrieve target folder or jar paths from multi-module Maven project

Posted by Mantas Gridinas <mg...@gmail.com>.
Wouldn't the help plugin get executed for every module in the reactor and
in turn output multiple build directories?

On Fri, Jun 10, 2022, 09:04 Delany <de...@gmail.com> wrote:

> Building on this, you could try this bash script. It is very slow
>
> while read -r pom; do mvn help:evaluate
> -Dexpression=project.build.directory -q -DforceStdout -f $pom && echo; done
> < <(find . -iname pom.xml)
>
>
> On Thu, 9 Jun 2022 at 21:20, Bernd Eckenfels <ec...@zusammenkunft.net>
> wrote:
>
> > The Maven Help Plugin has some functions, including printing evaluated
> > project parameters.
> >
> >
> > RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
> >
> > https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html
> >
> >
> > --
> > http://bernd.eckenfels.net
> > ________________________________
> > Von: Laurian Angelescu <an...@gmail.com>
> > Gesendet: Tuesday, June 7, 2022 5:43:26 PM
> > An: users@maven.apache.org <us...@maven.apache.org>
> > Betreff: How to retrieve target folder or jar paths from multi-module
> > Maven project
> >
> > Is it possible to invoke *mvn* on the command line to output either 1)
> the
> > paths to all target folders where jars get packaged or 2) the file paths
> of
> > the jars themselves?
> >
> > For example, in a multi-module project like
> > https://github.com/apache/httpcomponents-core.git, I would like to
> invoke:
> >
> > *mvn <magic-parameters>*
> >
> > and have output to standard out:
> >
> > /<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
> > /<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
> > ...
> > etc.
> >
> > I want to essentially be able to get a list of the JARs created in *any
> > *Maven
> > multimodule project.
> >
>

Re: How to retrieve target folder or jar paths from multi-module Maven project

Posted by Sylwester Lachiewicz <sl...@gmail.com>.
Maybe maven-deploy-plugin with custom deployment repository?

https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html

Sylwester

pt., 10 cze 2022, 08:05 użytkownik Delany <de...@gmail.com>
napisał:

> Building on this, you could try this bash script. It is very slow
>
> while read -r pom; do mvn help:evaluate
> -Dexpression=project.build.directory -q -DforceStdout -f $pom && echo; done
> < <(find . -iname pom.xml)
>
>
> On Thu, 9 Jun 2022 at 21:20, Bernd Eckenfels <ec...@zusammenkunft.net>
> wrote:
>
> > The Maven Help Plugin has some functions, including printing evaluated
> > project parameters.
> >
> >
> > RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
> >
> > https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html
> >
> >
> > --
> > http://bernd.eckenfels.net
> > ________________________________
> > Von: Laurian Angelescu <an...@gmail.com>
> > Gesendet: Tuesday, June 7, 2022 5:43:26 PM
> > An: users@maven.apache.org <us...@maven.apache.org>
> > Betreff: How to retrieve target folder or jar paths from multi-module
> > Maven project
> >
> > Is it possible to invoke *mvn* on the command line to output either 1)
> the
> > paths to all target folders where jars get packaged or 2) the file paths
> of
> > the jars themselves?
> >
> > For example, in a multi-module project like
> > https://github.com/apache/httpcomponents-core.git, I would like to
> invoke:
> >
> > *mvn <magic-parameters>*
> >
> > and have output to standard out:
> >
> > /<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
> > /<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
> > ...
> > etc.
> >
> > I want to essentially be able to get a list of the JARs created in *any
> > *Maven
> > multimodule project.
> >
>

Re: How to retrieve target folder or jar paths from multi-module Maven project

Posted by Delany <de...@gmail.com>.
Building on this, you could try this bash script. It is very slow

while read -r pom; do mvn help:evaluate
-Dexpression=project.build.directory -q -DforceStdout -f $pom && echo; done
< <(find . -iname pom.xml)


On Thu, 9 Jun 2022 at 21:20, Bernd Eckenfels <ec...@zusammenkunft.net> wrote:

> The Maven Help Plugin has some functions, including printing evaluated
> project parameters.
>
>
> RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
>
> https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html
>
>
> --
> http://bernd.eckenfels.net
> ________________________________
> Von: Laurian Angelescu <an...@gmail.com>
> Gesendet: Tuesday, June 7, 2022 5:43:26 PM
> An: users@maven.apache.org <us...@maven.apache.org>
> Betreff: How to retrieve target folder or jar paths from multi-module
> Maven project
>
> Is it possible to invoke *mvn* on the command line to output either 1) the
> paths to all target folders where jars get packaged or 2) the file paths of
> the jars themselves?
>
> For example, in a multi-module project like
> https://github.com/apache/httpcomponents-core.git, I would like to invoke:
>
> *mvn <magic-parameters>*
>
> and have output to standard out:
>
> /<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
> /<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
> ...
> etc.
>
> I want to essentially be able to get a list of the JARs created in *any
> *Maven
> multimodule project.
>

Re: How to retrieve target folder or jar paths from multi-module Maven project

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
The Maven Help Plugin has some functions, including printing evaluated project parameters.


RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html


--
http://bernd.eckenfels.net
________________________________
Von: Laurian Angelescu <an...@gmail.com>
Gesendet: Tuesday, June 7, 2022 5:43:26 PM
An: users@maven.apache.org <us...@maven.apache.org>
Betreff: How to retrieve target folder or jar paths from multi-module Maven project

Is it possible to invoke *mvn* on the command line to output either 1) the
paths to all target folders where jars get packaged or 2) the file paths of
the jars themselves?

For example, in a multi-module project like
https://github.com/apache/httpcomponents-core.git, I would like to invoke:

*mvn <magic-parameters>*

and have output to standard out:

/<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
/<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
...
etc.

I want to essentially be able to get a list of the JARs created in *any *Maven
multimodule project.

How to retrieve target folder or jar paths from multi-module Maven project

Posted by Laurian Angelescu <an...@gmail.com>.
Is it possible to invoke *mvn* on the command line to output either 1) the
paths to all target folders where jars get packaged or 2) the file paths of
the jars themselves?

For example, in a multi-module project like
https://github.com/apache/httpcomponents-core.git, I would like to invoke:

*mvn <magic-parameters>*

and have output to standard out:

/<project-root>/httpcore5/target/httpcore5-5.2-beta1.jar
/<project-root>/httpcore5-h2/target/httpcore5-h2-5.2-beta1.jar
...
etc.

I want to essentially be able to get a list of the JARs created in *any *Maven
multimodule project.