You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Tony Chemit <ch...@codelutin.com> on 2012/04/30 12:29:31 UTC

how to obtain project class-path with all his dependencies

Hi,

I'd like to know if there is an existing helper code to obtain for a given scope
a fresh class-path containing all dependencies of a maven module.

I had once written it [1] but now I will if it exists use something from a maven (or codehaus) -lib.

Thanks for replies,

tony.

[1] http://nuiton.org/projects/maven-helper-plugin/repository/entry/trunk/src/main/java/org/nuiton/plugin/AbstractPlugin.java#L667

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


Re: how to obtain project class-path with all his dependencies

Posted by Tony Chemit <ch...@codelutin.com>.
On Mon, 30 Apr 2012 12:22:44 +0100
Stephen Connolly <st...@gmail.com> wrote:

> So look at the plugin's source code ;-)
rohhh Stephen, please don't hurt me :) I just wonder if somebody knows a nice helper method to do that inside a share component.


I already have a working code, and I looked in the dependency plugin, 
it is not exactly what I want, but... Nice try man ;)

> 
> On 30 April 2012 11:56, Tony Chemit <ch...@codelutin.com> wrote:
> 
> > On Mon, 30 Apr 2012 06:46:10 -0400
> > "Jason Pyeron" <jp...@pdinc.us> wrote:
> >
> > > > -----Original Message-----
> > > > From: Tony Chemit
> > > > Sent: Monday, April 30, 2012 6:30
> > > >
> > > > Hi,
> > > >
> > > > I'd like to know if there is an existing helper code to
> > > > obtain for a given scope a fresh class-path containing all
> > > > dependencies of a maven module.
> > >
> > > Could be misunderstanding you, but googling dependency classpath gets me
> > >
> > http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
> > > l
> > >
> > Hum this is a misunderstanding :)
> >
> > I want to obtain a class-path while doing some stuff in a new mojo.
> >
> > Thanks anyway.
> >
> > >
> > >
> > > --
> > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > > -                                                               -
> > > - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> > > - Principal Consultant              10 West 24th Street #100    -
> > > - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
> > > -                                                               -
> > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > > This message is copyright PD Inc, subject to license 20080407P00.
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> >
> >
> >
> > --
> > Tony Chemit
> > --------------------
> > tél: +33 (0) 2 40 50 29 28
> > email: chemit@codelutin.com
> > http://www.codelutin.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >



-- 
Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: chemit@codelutin.com
http://www.codelutin.com

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


Re: how to obtain project class-path with all his dependencies

Posted by Stephen Connolly <st...@gmail.com>.
So look at the plugin's source code ;-)

On 30 April 2012 11:56, Tony Chemit <ch...@codelutin.com> wrote:

> On Mon, 30 Apr 2012 06:46:10 -0400
> "Jason Pyeron" <jp...@pdinc.us> wrote:
>
> > > -----Original Message-----
> > > From: Tony Chemit
> > > Sent: Monday, April 30, 2012 6:30
> > >
> > > Hi,
> > >
> > > I'd like to know if there is an existing helper code to
> > > obtain for a given scope a fresh class-path containing all
> > > dependencies of a maven module.
> >
> > Could be misunderstanding you, but googling dependency classpath gets me
> >
> http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
> > l
> >
> Hum this is a misunderstanding :)
>
> I want to obtain a class-path while doing some stuff in a new mojo.
>
> Thanks anyway.
>
> >
> >
> > --
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > -                                                               -
> > - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> > - Principal Consultant              10 West 24th Street #100    -
> > - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
> > -                                                               -
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > This message is copyright PD Inc, subject to license 20080407P00.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
>
>
>
> --
> Tony Chemit
> --------------------
> tél: +33 (0) 2 40 50 29 28
> email: chemit@codelutin.com
> http://www.codelutin.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: how to obtain project class-path with all his dependencies

Posted by Tony Chemit <ch...@codelutin.com>.
On Mon, 30 Apr 2012 14:59:12 +0100 (BST)
Mark Struberg <st...@yahoo.de> wrote:

> Nope, guess there is no helper yet.
> 
> But the only code part which is a bit more non-obvious is the one which applies the ClassPath to the plugin itself:
> 
> https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMojo.java
> 
> See 
> 
> protected void extendRealmClasspath()

Yes I had a look at it and the code is fine to me (since my previous code was using artifact.file to obtain url path of dependencies).

I will use the code of the openJpa plugin.

thanks.

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


Re: how to obtain project class-path with all his dependencies

Posted by Mark Struberg <st...@yahoo.de>.
Nope, guess there is no helper yet.

But the only code part which is a bit more non-obvious is the one which applies the ClassPath to the plugin itself:

https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/AbstractOpenJpaMojo.java

See 

protected void extendRealmClasspath()


LieGrue,
strub



----- Original Message -----
> From: Tony Chemit <ch...@codelutin.com>
> To: dev@maven.apache.org
> Cc: 
> Sent: Monday, April 30, 2012 2:52 PM
> Subject: Re: how to obtain project class-path with all his dependencies
> 
> On Mon, 30 Apr 2012 12:19:25 +0100 (BST)
> Mark Struberg <st...@yahoo.de> wrote:
> 
>>  please look at the openjpa-maven-plugin [1].
>>  Check the following classes: OpenJpaEnhancerMojo.java, 
> OpenJpaTestEnhancerMojo.java and AbstractOpenJpaMojo.java
>> 
>>  Here are the important parts:
>> 
>> 
>>  /** * List of all class path elements that will be searched for the * 
> <code>persistence-enabled</code> classes and resources expected by * 
> PCEnhancer. *  * @parameter 
> default-value="${project.compileClasspathElements}" * @required * 
> @readonly */ protected List<String> compileClasspathElements; 
>> 
>>  /** * List of all class path elements that will be searched for the * 
> <code>persistence-enabled</code> classes and resources expected by * 
> PCEnhancer. * * @parameter 
> default-value="${project.testClasspathElements}" * @required * 
> @readonly */ protected List<String> testClasspathElements;
>> 
>> 
>> 
>> 
>>  In the openjpa-maven-plugin I'm using the compile or test classpath to 
> do some bytecode magic on the classes.
>> 
>>  Is this what you were looking for?
> 
> Yeah moreabout.
> 
> I had a similar code, but I was just looking for a helper to do it, but perhaps 
> it does not exists ?
> 
> anyway thanks for your reply Mark
> 
>> 
>> 
>>  LieGrue,
>>  strub
>> 
>>  [1] 
> https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/
>> 
>> 
>> 
>>  ----- Original Message -----
>>  > From: Tony Chemit <ch...@codelutin.com>
>>  > To: dev@maven.apache.org
>>  > Cc: 
>>  > Sent: Monday, April 30, 2012 12:56 PM
>>  > Subject: Re: how to obtain project class-path with all his 
> dependencies
>>  > 
>>  > On Mon, 30 Apr 2012 06:46:10 -0400
>>  > "Jason Pyeron" <jp...@pdinc.us> wrote:
>>  > 
>>  >>  > -----Original Message-----
>>  >>  > From: Tony Chemit 
>>  >>  > Sent: Monday, April 30, 2012 6:30
>>  >>  > 
>>  >>  > Hi,
>>  >>  > 
>>  >>  > I'd like to know if there is an existing helper code to 
>>  >>  > obtain for a given scope a fresh class-path containing all 
>>  >>  > dependencies of a maven module.
>>  >> 
>>  >>  Could be misunderstanding you, but googling dependency classpath 
> gets me
>>  >> 
>>  > 
> http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
>>  >>  l
>>  >> 
>>  > Hum this is a misunderstanding :)
>>  > 
>>  > I want to obtain a class-path while doing some stuff in a new mojo.
>>  > 
>>  > Thanks anyway.
>>  > 
>>  >> 
>>  >> 
>>  >>  --
>>  >>  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>  >>  -                                                               -
>>  >>  - Jason Pyeron                      PD Inc. http://www.pdinc.us -
>>  >>  - Principal Consultant              10 West 24th Street #100    -
>>  >>  - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
>>  >>  -                                                               -
>>  >>  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>  >>  This message is copyright PD Inc, subject to license 20080407P00.
>>  >> 
>>  >>   
>>  >> 
>>  >> 
>>  >>  
> ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>  >>  For additional commands, e-mail: dev-help@maven.apache.org
>>  >> 
>>  > 
>>  > 
>>  > 
>>  > -- 
>>  > Tony Chemit
>>  > --------------------
>>  > tél: +33 (0) 2 40 50 29 28
>>  > email: chemit@codelutin.com
>>  > http://www.codelutin.com
>>  > 
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>  > For additional commands, e-mail: dev-help@maven.apache.org
>>  > 
>> 
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>  For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> 
> -- 
> Tony Chemit
> --------------------
> tél: +33 (0) 2 40 50 29 28
> email: chemit@codelutin.com
> http://www.codelutin.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

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


Re: how to obtain project class-path with all his dependencies

Posted by Tony Chemit <ch...@codelutin.com>.
On Mon, 30 Apr 2012 12:19:25 +0100 (BST)
Mark Struberg <st...@yahoo.de> wrote:

> please look at the openjpa-maven-plugin [1].
> Check the following classes: OpenJpaEnhancerMojo.java, OpenJpaTestEnhancerMojo.java and AbstractOpenJpaMojo.java
> 
> Here are the important parts:
> 
> 
> /** * List of all class path elements that will be searched for the * <code>persistence-enabled</code> classes and resources expected by * PCEnhancer. *  * @parameter default-value="${project.compileClasspathElements}" * @required * @readonly */ protected List<String> compileClasspathElements; 
> 
> /** * List of all class path elements that will be searched for the * <code>persistence-enabled</code> classes and resources expected by * PCEnhancer. * * @parameter default-value="${project.testClasspathElements}" * @required * @readonly */ protected List<String> testClasspathElements;
> 
> 
> 
> 
> In the openjpa-maven-plugin I'm using the compile or test classpath to do some bytecode magic on the classes.
> 
> Is this what you were looking for?

Yeah moreabout.

I had a similar code, but I was just looking for a helper to do it, but perhaps it does not exists ?

anyway thanks for your reply Mark

> 
> 
> LieGrue,
> strub
> 
> [1] https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/
> 
> 
> 
> ----- Original Message -----
> > From: Tony Chemit <ch...@codelutin.com>
> > To: dev@maven.apache.org
> > Cc: 
> > Sent: Monday, April 30, 2012 12:56 PM
> > Subject: Re: how to obtain project class-path with all his dependencies
> > 
> > On Mon, 30 Apr 2012 06:46:10 -0400
> > "Jason Pyeron" <jp...@pdinc.us> wrote:
> > 
> >>  > -----Original Message-----
> >>  > From: Tony Chemit 
> >>  > Sent: Monday, April 30, 2012 6:30
> >>  > 
> >>  > Hi,
> >>  > 
> >>  > I'd like to know if there is an existing helper code to 
> >>  > obtain for a given scope a fresh class-path containing all 
> >>  > dependencies of a maven module.
> >> 
> >>  Could be misunderstanding you, but googling dependency classpath gets me
> >> 
> > http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
> >>  l
> >> 
> > Hum this is a misunderstanding :)
> > 
> > I want to obtain a class-path while doing some stuff in a new mojo.
> > 
> > Thanks anyway.
> > 
> >> 
> >> 
> >>  --
> >>  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> >>  -                                                               -
> >>  - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> >>  - Principal Consultant              10 West 24th Street #100    -
> >>  - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
> >>  -                                                               -
> >>  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> >>  This message is copyright PD Inc, subject to license 20080407P00.
> >> 
> >>   
> >> 
> >> 
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >>  For additional commands, e-mail: dev-help@maven.apache.org
> >> 
> > 
> > 
> > 
> > -- 
> > Tony Chemit
> > --------------------
> > tél: +33 (0) 2 40 50 29 28
> > email: chemit@codelutin.com
> > http://www.codelutin.com
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 



-- 
Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: chemit@codelutin.com
http://www.codelutin.com

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


Re: how to obtain project class-path with all his dependencies

Posted by Mark Struberg <st...@yahoo.de>.
please look at the openjpa-maven-plugin [1].
Check the following classes: OpenJpaEnhancerMojo.java, OpenJpaTestEnhancerMojo.java and AbstractOpenJpaMojo.java

Here are the important parts:


/** * List of all class path elements that will be searched for the * <code>persistence-enabled</code> classes and resources expected by * PCEnhancer. *  * @parameter default-value="${project.compileClasspathElements}" * @required * @readonly */ protected List<String> compileClasspathElements; 

/** * List of all class path elements that will be searched for the * <code>persistence-enabled</code> classes and resources expected by * PCEnhancer. * * @parameter default-value="${project.testClasspathElements}" * @required * @readonly */ protected List<String> testClasspathElements;




In the openjpa-maven-plugin I'm using the compile or test classpath to do some bytecode magic on the classes.

Is this what you were looking for?


LieGrue,
strub

[1] https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-tools/openjpa-maven-plugin/src/main/java/org/apache/openjpa/tools/maven/



----- Original Message -----
> From: Tony Chemit <ch...@codelutin.com>
> To: dev@maven.apache.org
> Cc: 
> Sent: Monday, April 30, 2012 12:56 PM
> Subject: Re: how to obtain project class-path with all his dependencies
> 
> On Mon, 30 Apr 2012 06:46:10 -0400
> "Jason Pyeron" <jp...@pdinc.us> wrote:
> 
>>  > -----Original Message-----
>>  > From: Tony Chemit 
>>  > Sent: Monday, April 30, 2012 6:30
>>  > 
>>  > Hi,
>>  > 
>>  > I'd like to know if there is an existing helper code to 
>>  > obtain for a given scope a fresh class-path containing all 
>>  > dependencies of a maven module.
>> 
>>  Could be misunderstanding you, but googling dependency classpath gets me
>> 
> http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
>>  l
>> 
> Hum this is a misunderstanding :)
> 
> I want to obtain a class-path while doing some stuff in a new mojo.
> 
> Thanks anyway.
> 
>> 
>> 
>>  --
>>  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>  -                                                               -
>>  - Jason Pyeron                      PD Inc. http://www.pdinc.us -
>>  - Principal Consultant              10 West 24th Street #100    -
>>  - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
>>  -                                                               -
>>  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>  This message is copyright PD Inc, subject to license 20080407P00.
>> 
>>   
>> 
>> 
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>  For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> 
> -- 
> Tony Chemit
> --------------------
> tél: +33 (0) 2 40 50 29 28
> email: chemit@codelutin.com
> http://www.codelutin.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

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


Re: how to obtain project class-path with all his dependencies

Posted by Tony Chemit <ch...@codelutin.com>.
On Mon, 30 Apr 2012 06:46:10 -0400
"Jason Pyeron" <jp...@pdinc.us> wrote:

> > -----Original Message-----
> > From: Tony Chemit 
> > Sent: Monday, April 30, 2012 6:30
> > 
> > Hi,
> > 
> > I'd like to know if there is an existing helper code to 
> > obtain for a given scope a fresh class-path containing all 
> > dependencies of a maven module.
> 
> Could be misunderstanding you, but googling dependency classpath gets me
> http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
> l
> 
Hum this is a misunderstanding :)

I want to obtain a class-path while doing some stuff in a new mojo.

Thanks anyway.

> 
> 
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> -                                                               -
> - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> - Principal Consultant              10 West 24th Street #100    -
> - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
> -                                                               -
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> This message is copyright PD Inc, subject to license 20080407P00.
> 
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 



-- 
Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: chemit@codelutin.com
http://www.codelutin.com

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


RE: how to obtain project class-path with all his dependencies

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Tony Chemit 
> Sent: Monday, April 30, 2012 6:30
> 
> Hi,
> 
> I'd like to know if there is an existing helper code to 
> obtain for a given scope a fresh class-path containing all 
> dependencies of a maven module.

Could be misunderstanding you, but googling dependency classpath gets me
http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.htm
l



--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 


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