You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Steve Lihn <st...@gmail.com> on 2009/05/06 05:10:27 UTC

How to use maven to gather all (or some) dependent jar files

Hi,
When maven builds a project, it figures out all the dependent jar
files, adds them to the classpath, produces the project's jar file
under target/.

My question is -- is there a way to ask maven also puts all (or some)
those dependent jar files under target/ too.

The origin of the issue is that we have a project that builds a jar
for Mule. However, when deploying this jar file to Mule, we still have
to collect all the dependent jar files that Mule does not have and
place them under Mule's lib/user/ folder. So every time we upgrade a
dependency, for instance, json-lib from 2.2.2 to 2.2.3, we not only
have to modify the pom.xml, but also look for json-lib 2.2.3 jar and
make sure we upgrade it in lib/user/.

Wouldn't it be easier if maven can figure these all out for us since
it is all in pom.xml ?

Thanks,
Steve

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


RE: How to use maven to gather all (or some) dependent jar files

Posted by Andrei Solntsev <as...@hireright.ee>.
Hi Steve,
There is a simple answer: mvn dependency:copy-dependencies

Please refer to http://maven.apache.org/plugins/maven-dependency-plugin/


Andrei Solntsev,
Software Developer 

HireRight Estonia AS


-----Original Message-----
From: Steve Lihn [mailto:stevelihn@gmail.com] 
Sent: Wednesday, May 06, 2009 6:10 AM
To: Maven Users List
Subject: How to use maven to gather all (or some) dependent jar files

Hi,
When maven builds a project, it figures out all the dependent jar
files, adds them to the classpath, produces the project's jar file
under target/.

My question is -- is there a way to ask maven also puts all (or some)
those dependent jar files under target/ too.

The origin of the issue is that we have a project that builds a jar
for Mule. However, when deploying this jar file to Mule, we still have
to collect all the dependent jar files that Mule does not have and
place them under Mule's lib/user/ folder. So every time we upgrade a
dependency, for instance, json-lib from 2.2.2 to 2.2.3, we not only
have to modify the pom.xml, but also look for json-lib 2.2.3 jar and
make sure we upgrade it in lib/user/.

Wouldn't it be easier if maven can figure these all out for us since
it is all in pom.xml ?

Thanks,
Steve

---------------------------------------------------------------------
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 use maven to gather all (or some) dependent jar files

Posted by Steve Lihn <st...@gmail.com>.
Copy-dependencies and the assembly plugin are what I am looking for. I
currently use a home grown perl script to do these tasks. It will be
very nice once I can integrate all these tasks into maven.

Thanks for the suggestions.
Steve

On Mon, May 11, 2009 at 9:08 AM, Joe Hindsley <jh...@gmail.com> wrote:
> The way I've done this in the past is to use the assembly plugin to generate
> a distribution zip/tar.
>
> The unpacked structure looks like:
> /bin
> /lib
> /conf
> /log
>
> In the bin directory, you would add a shell script that sets up the runtime
> environment and invokes the mule runtime. The lib directory would be the
> destination of all of the dependency jars. The conf directory would hold
> your mule, log4j, db, etc configuration files. The log directory would be
> the destination for any log files created when running mule.
>
> The advantage to this method is that you shouldn't have to touch your base
> installation of mule to run your application.
>
> Hope this helps,
>
> Joe Hindsley
>
>
> Steve Lihn wrote:
>>
>> Hi,
>> When maven builds a project, it figures out all the dependent jar
>> files, adds them to the classpath, produces the project's jar file
>> under target/.
>>
>> My question is -- is there a way to ask maven also puts all (or some)
>> those dependent jar files under target/ too.
>>
>> The origin of the issue is that we have a project that builds a jar
>> for Mule. However, when deploying this jar file to Mule, we still have
>> to collect all the dependent jar files that Mule does not have and
>> place them under Mule's lib/user/ folder. So every time we upgrade a
>> dependency, for instance, json-lib from 2.2.2 to 2.2.3, we not only
>> have to modify the pom.xml, but also look for json-lib 2.2.3 jar and
>> make sure we upgrade it in lib/user/.
>>
>> Wouldn't it be easier if maven can figure these all out for us since
>> it is all in pom.xml ?
>>
>> Thanks,
>> Steve
>>

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


Re: How to use maven to gather all (or some) dependent jar files

Posted by Joe Hindsley <jh...@gmail.com>.
The way I've done this in the past is to use the assembly plugin to 
generate a distribution zip/tar.

The unpacked structure looks like:
/bin
/lib
/conf
/log

In the bin directory, you would add a shell script that sets up the 
runtime environment and invokes the mule runtime. The lib directory 
would be the destination of all of the dependency jars. The conf 
directory would hold your mule, log4j, db, etc configuration files. The 
log directory would be the destination for any log files created when 
running mule.

The advantage to this method is that you shouldn't have to touch your 
base installation of mule to run your application.

Hope this helps,

Joe Hindsley


Steve Lihn wrote:
> Hi,
> When maven builds a project, it figures out all the dependent jar
> files, adds them to the classpath, produces the project's jar file
> under target/.
> 
> My question is -- is there a way to ask maven also puts all (or some)
> those dependent jar files under target/ too.
> 
> The origin of the issue is that we have a project that builds a jar
> for Mule. However, when deploying this jar file to Mule, we still have
> to collect all the dependent jar files that Mule does not have and
> place them under Mule's lib/user/ folder. So every time we upgrade a
> dependency, for instance, json-lib from 2.2.2 to 2.2.3, we not only
> have to modify the pom.xml, but also look for json-lib 2.2.3 jar and
> make sure we upgrade it in lib/user/.
> 
> Wouldn't it be easier if maven can figure these all out for us since
> it is all in pom.xml ?
> 
> Thanks,
> Steve
> 
> ---------------------------------------------------------------------
> 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