You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stevo Slavić <ss...@gmail.com> on 2009/10/09 16:14:31 UTC
Re: Maven assembler plugin - How to avoid duplicating configurations
in assembler descriptors?
http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/using-components.html
Regards,
Stevo.
On Fri, Oct 9, 2009 at 4:12 PM, Jaikiran <ja...@yahoo.co.in> wrote:
>
> Hello everyone,
>
> I have a project org.myapp:proj which is a jar artifact. This project is
> configured to use maven-assembler-plugin to create a custom artifact (let's
> say proj-client1.jar). The descriptor configuration xml (let's call it
> client1-assembler.xml) used for this assembler plugin looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <assembly xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/assembly-1.0.0.xsd"
> >
> <id>clien1</id>
> <formats>
> <format>jar</format>
> </formats>
> <includeBaseDirectory>false</includeBaseDirectory>
> <fileSets>
> <fileSet>
> <directory>src/main/resources</directory>
> <excludes>
> <exclude>blah.xml</exclude>
> </excludes>
> <outputDirectory>packages</outputDirectory>
> </fileSet>
> </fileSets>
> <dependencySets>
> <dependencySet>
>
> <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
> <includes>
> <include>ant-contrib:ant-contrib</include>
> <include>org.myapp.abc:xyz:jar</include>
>
>
> Now for this same project i need to generate another artifact
> proj-client2.jar which does the exact same thing as the descriptor in
> client1 *and also* adds its own set of libraries in the resultant artifact.
>
> So a very simple way to achieve this would be to copy-paste the contents of
> the client1-assembler.xml and create a client2-assembler.xml. The
> client2-assembler.xml will then also have its own custom configurations.
> The
> assembler plugin can then use this as:
>
> <plugin>
> <artifactId>maven-assembly-plugin</artifactId>
> <version>2.2-beta-1</version>
> <executions>
> <execution>
> <id>make-assembly</id>
> <phase>package</phase>
> <goals>
> <goal>single</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <descriptors>
>
> <descriptor>src/main/resources/client1-assembler.xml</descriptor>
>
> <descriptor>src/main/resources/client2-assembler.xml</descriptor>
> </descriptors>
>
>
> However, copy/paste from client1-assembler.xml to client2-assembler.xml
> just
> leads to duplicacy and maintenance nightmare (someone would have to ensure
> that whatever changes happen to client1-assembler.xml is applied manually
> even to client2-assembler.xml).
>
> Is there a way i can avoid this duplicacy? Something on the lines of
> client2-assembler.xml "referencing" or "inheriting" from
> client1-assembler.xml. Is this possible or anything similar?
>
>
> --
> View this message in context:
> http://www.nabble.com/Maven-assembler-plugin---How-to-avoid-duplicating-configurations-in-assembler-descriptors--tp25821854p25821854.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Maven assembler plugin - How to avoid duplicating
configurations in assembler descriptors?
Posted by Jaikiran <ja...@yahoo.co.in>.
Excellent! Thanks for the quick response - i had been trying a lot of
different ways of doing this, since this morning :)
-Jaikiran
Stevo Slavic wrote:
>
> http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/using-components.html
>
> Regards,
> Stevo.
>
--
View this message in context: http://www.nabble.com/Maven-assembler-plugin---How-to-avoid-duplicating-configurations-in-assembler-descriptors--tp25821854p25822200.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org