You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gao Lin <ao...@gmail.com> on 2010/12/29 03:53:33 UTC

How to make a single dependency packaged into target jar?

Hi:

I need to make a single jar as the project output, and it needs some
of (not all) it`s dependencies packaged into the lib/ directory in the
target jar file, how to write the pom.xml ?

example:

     <dependencies>

   <groupId>org.rhq</groupId>
   <artifactId>rhq-httpcheck-plugin</artifactId>
   <version>1.0.0</version>
   <packaging>jar</packaging>

      <dependency>
         <groupId>sun-javamail</groupId>
         <artifactId>mail</artifactId>
         <version>1.4</version>
         <scope>compile</scope>
      </dependency>

      <dependency>
         <groupId>${rhq.groupId}</groupId>
         <artifactId>rhq-core-plugin-container</artifactId>
         <version>1.3.0.GA</version>
         <scope>test</scope>
      </dependency>
  </dependencies>

The sun-javamail should be packaged into rhq-httpcheck-plugin.jar file
in the lib/ directory, the rhq-core-plugin-container should not, how
can I do that?


-- 
Thanks and Best Regards

aoingl@gmail.com

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


Re: How to make a single dependency packaged into target jar?

Posted by Simone Tripodi <si...@gmail.com>.
Hi Gao,
just to let you know, there are also good alternatives, you've just to
choose which one fits better with your needs:

 * The Apache's Shade plugin[1]
 * The Sonatypes's JarJar plugin[2]

My preferred is the Sonatype's one because it allows define classes
rewrite rules (you can repackage dependencies under a custom name).
All the best,
Simo

[1] http://maven.apache.org/plugins/maven-shade-plugin/
[2] http://sonatype.github.com/jarjar-maven-plugin/

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



2010/12/29 Maxime Gréau <gr...@gmail.com>:
> Hi,
>
> To do this kind of thing, you have to use the maven-assembly-plugin (
> http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies
> *).*
>
> Maxime Gréau.
> http://mgreau.com
>
>
>
> 2010/12/29 Gao Lin <ao...@gmail.com>
>
>> Hi:
>>
>> I need to make a single jar as the project output, and it needs some
>> of (not all) it`s dependencies packaged into the lib/ directory in the
>> target jar file, how to write the pom.xml ?
>>
>> example:
>>
>>     <dependencies>
>>
>>   <groupId>org.rhq</groupId>
>>   <artifactId>rhq-httpcheck-plugin</artifactId>
>>   <version>1.0.0</version>
>>   <packaging>jar</packaging>
>>
>>      <dependency>
>>         <groupId>sun-javamail</groupId>
>>         <artifactId>mail</artifactId>
>>         <version>1.4</version>
>>         <scope>compile</scope>
>>      </dependency>
>>
>>      <dependency>
>>         <groupId>${rhq.groupId}</groupId>
>>         <artifactId>rhq-core-plugin-container</artifactId>
>>         <version>1.3.0.GA</version>
>>         <scope>test</scope>
>>      </dependency>
>>  </dependencies>
>>
>> The sun-javamail should be packaged into rhq-httpcheck-plugin.jar file
>> in the lib/ directory, the rhq-core-plugin-container should not, how
>> can I do that?
>>
>>
>> --
>> Thanks and Best Regards
>>
>> aoingl@gmail.com
>>
>> ---------------------------------------------------------------------
>> 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 make a single dependency packaged into target jar?

Posted by Maxime Gréau <gr...@gmail.com>.
Hi,

To do this kind of thing, you have to use the maven-assembly-plugin (
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies
*).*

Maxime Gréau.
http://mgreau.com



2010/12/29 Gao Lin <ao...@gmail.com>

> Hi:
>
> I need to make a single jar as the project output, and it needs some
> of (not all) it`s dependencies packaged into the lib/ directory in the
> target jar file, how to write the pom.xml ?
>
> example:
>
>     <dependencies>
>
>   <groupId>org.rhq</groupId>
>   <artifactId>rhq-httpcheck-plugin</artifactId>
>   <version>1.0.0</version>
>   <packaging>jar</packaging>
>
>      <dependency>
>         <groupId>sun-javamail</groupId>
>         <artifactId>mail</artifactId>
>         <version>1.4</version>
>         <scope>compile</scope>
>      </dependency>
>
>      <dependency>
>         <groupId>${rhq.groupId}</groupId>
>         <artifactId>rhq-core-plugin-container</artifactId>
>         <version>1.3.0.GA</version>
>         <scope>test</scope>
>      </dependency>
>  </dependencies>
>
> The sun-javamail should be packaged into rhq-httpcheck-plugin.jar file
> in the lib/ directory, the rhq-core-plugin-container should not, how
> can I do that?
>
>
> --
> Thanks and Best Regards
>
> aoingl@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>