You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Curtis Rueden <ct...@wisc.edu> on 2012/09/21 18:26:06 UTC
Invoking Maven goals outside a project directory structure
Hi everyone,
I was wondering whether there is a way to utilize certain useful Maven
goals when outside of a particular Maven project's actual source directory
structure. For example, I would like to ask Maven for the effective POM of
an installed artifact.
Why? Because I want to know the classpath fragment (all necessary JARs from
the local repository cache) for a given GAV.
I started writing a script to compute it manually. Current work in progress
is here:
https://gist.github.com/3762396
However, it would be nice to lean on the Maven command line tool to do the
heavy lifting, rather than doing recursive parsing like my script does now.
I definitely don't want to reinvent all the goodness that Maven provides.
Right now, there are many things the script can't deal with:
1) downloading missing artifacts from a remote repository;
2) computing an effective POM for the project;
3) resolving properties properly from that effective POM...
Just to name a few at the tip of the iceberg.
It seems like many Maven goals (e.g., help:effective-pom, dependency:list,
dependency:tree) would make sense to invoke with respect to a given Maven
project, when outside of that project's actual source folder.
Is this at all possible? Or any alternative suggestion to achieve my goals
here?
Thanks,
Curtis
Re: Invoking Maven goals outside a project directory structure
Posted by Anders Hammar <an...@hammar.net>.
Possibly you could have a look at if your repo manager could help you
with this. I know that Nexus has this feature [1]; possibly other repo
managers do as well.
/Anders
[1] http://www.sonatype.com/books/nexus-book/reference/using-sect-browsing.html#fig-using-dependencies
On Fri, Sep 21, 2012 at 6:26 PM, Curtis Rueden <ct...@wisc.edu> wrote:
> Hi everyone,
>
> I was wondering whether there is a way to utilize certain useful Maven
> goals when outside of a particular Maven project's actual source directory
> structure. For example, I would like to ask Maven for the effective POM of
> an installed artifact.
>
> Why? Because I want to know the classpath fragment (all necessary JARs from
> the local repository cache) for a given GAV.
>
> I started writing a script to compute it manually. Current work in progress
> is here:
> https://gist.github.com/3762396
>
> However, it would be nice to lean on the Maven command line tool to do the
> heavy lifting, rather than doing recursive parsing like my script does now.
> I definitely don't want to reinvent all the goodness that Maven provides.
> Right now, there are many things the script can't deal with:
> 1) downloading missing artifacts from a remote repository;
> 2) computing an effective POM for the project;
> 3) resolving properties properly from that effective POM...
> Just to name a few at the tip of the iceberg.
>
> It seems like many Maven goals (e.g., help:effective-pom, dependency:list,
> dependency:tree) would make sense to invoke with respect to a given Maven
> project, when outside of that project's actual source folder.
>
> Is this at all possible? Or any alternative suggestion to achieve my goals
> here?
>
> Thanks,
> Curtis
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Invoking Maven goals outside a project directory structure
Posted by Curtis Rueden <ct...@wisc.edu>.
Hi all,
Thanks Roy for the suggestion of SCM bootstrapping. That is definitely a
"big hammer" solution that would allow execution of any goal.
However, I found a workaround for the specific case of help:effective-pom.
If you want the effective POM for project foo:bar:1.0.0, you can run:
mvn -f ~/.m2/repository/foo/bar/1.0.0/bar-1.0.0.pom help:effective-pom
Since that particular goal really only needs the POM, not the entire source
directory structure. Seems to work well for the projects I care about so
far, at least. And dependency:list and dependency:tree work too!
Regards,
Curtis
On Fri, Sep 21, 2012 at 11:36 AM, Lyons, Roy <Ro...@cmegroup.com> wrote:
> I have a possible interesting suggestion for you. Scm plugin
> bootstrapping.
>
> http://maven.apache.org/scm/maven-scm-plugin/bootstrap-mojo.html
>
>
> Given a pom with an scm section defined, you could bootstrap its entire
> repo down and the perform the tasks you are trying to accomplish.
>
> http://maven.apache.org/scm/maven-scm-plugin/examples/bootstrapping-with-po
> m.html
>
>
> Right now there isn't a great way to do the effective pom -- I know I have
> tried to do so as well, and ended up just cloning down the repositories I
> needed.
>
>
>
>
>
> On 9/21/12 11:26 AM, "Curtis Rueden" <ct...@wisc.edu> wrote:
>
> >Hi everyone,
> >
> >I was wondering whether there is a way to utilize certain useful Maven
> >goals when outside of a particular Maven project's actual source directory
> >structure. For example, I would like to ask Maven for the effective POM of
> >an installed artifact.
> >
> >Why? Because I want to know the classpath fragment (all necessary JARs
> >from
> >the local repository cache) for a given GAV.
> >
> >I started writing a script to compute it manually. Current work in
> >progress
> >is here:
> > https://gist.github.com/3762396
> >
> >However, it would be nice to lean on the Maven command line tool to do the
> >heavy lifting, rather than doing recursive parsing like my script does
> >now.
> >I definitely don't want to reinvent all the goodness that Maven provides.
> >Right now, there are many things the script can't deal with:
> > 1) downloading missing artifacts from a remote repository;
> > 2) computing an effective POM for the project;
> > 3) resolving properties properly from that effective POM...
> >Just to name a few at the tip of the iceberg.
> >
> >It seems like many Maven goals (e.g., help:effective-pom, dependency:list,
> >dependency:tree) would make sense to invoke with respect to a given Maven
> >project, when outside of that project's actual source folder.
> >
> >Is this at all possible? Or any alternative suggestion to achieve my goals
> >here?
> >
> >Thanks,
> >Curtis
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Invoking Maven goals outside a project directory structure
Posted by "Lyons, Roy" <Ro...@cmegroup.com>.
I have a possible interesting suggestion for you. Scm plugin
bootstrapping.
http://maven.apache.org/scm/maven-scm-plugin/bootstrap-mojo.html
Given a pom with an scm section defined, you could bootstrap its entire
repo down and the perform the tasks you are trying to accomplish.
http://maven.apache.org/scm/maven-scm-plugin/examples/bootstrapping-with-po
m.html
Right now there isn't a great way to do the effective pom -- I know I have
tried to do so as well, and ended up just cloning down the repositories I
needed.
On 9/21/12 11:26 AM, "Curtis Rueden" <ct...@wisc.edu> wrote:
>Hi everyone,
>
>I was wondering whether there is a way to utilize certain useful Maven
>goals when outside of a particular Maven project's actual source directory
>structure. For example, I would like to ask Maven for the effective POM of
>an installed artifact.
>
>Why? Because I want to know the classpath fragment (all necessary JARs
>from
>the local repository cache) for a given GAV.
>
>I started writing a script to compute it manually. Current work in
>progress
>is here:
> https://gist.github.com/3762396
>
>However, it would be nice to lean on the Maven command line tool to do the
>heavy lifting, rather than doing recursive parsing like my script does
>now.
>I definitely don't want to reinvent all the goodness that Maven provides.
>Right now, there are many things the script can't deal with:
> 1) downloading missing artifacts from a remote repository;
> 2) computing an effective POM for the project;
> 3) resolving properties properly from that effective POM...
>Just to name a few at the tip of the iceberg.
>
>It seems like many Maven goals (e.g., help:effective-pom, dependency:list,
>dependency:tree) would make sense to invoke with respect to a given Maven
>project, when outside of that project's actual source folder.
>
>Is this at all possible? Or any alternative suggestion to achieve my goals
>here?
>
>Thanks,
>Curtis
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org