You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Barrie Treloar <ba...@gmail.com> on 2006/07/18 09:16:46 UTC
[m2] assembly and use of dependencySet excludes
For those that may be trying to work out how excludes works I'm
posting to the list.
There is probably a JIRA issue (I haven't looked) that will address
pattern matching of excludes, there are comments in the code to
indicate that this would be a good feature.
To summarize my problem:
I have a module called <project>-build which creates an assembly of
all the other modules so that this can be given to our test team in
one go. The problem I am having is that the assembly is not only
copying the *-bin.zip files but also the *.jar files even though the
dependency is only on the zip file.
My pom has this in it:
<dependencies>
<dependency>
<groupId>GROUP</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
<classifier>bin</classifier>
<type>zip</type>
</dependency>
<dependency>
<groupId>GROUP</groupId>
<artifactId>B</artifactId>
<version>0.0.1-SNAPSHOT</version>
<classifier>bin</classifier>
<type>zip</type>
</dependency>
<dependency>
<groupId>GROUP</groupId>
<artifactId>C</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ear</type>
</dependency>
</dependencies>
To work around this, I am excluding the jars using the assembly below:
<assembly>
<id>bin</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<excludes>
<!--
There is little documentation on this format.
It is of the form of DefaultArtifact.getDependencyConflictId()
which is <groupId>:<artifactId>:<type>:<classifier>
or you can use the short form (hard coded into assembly) of
<groupId>:<artifactId>
This is a String equality match not a pattern match.
-->
<exclude>commons-lang:commons-lang</exclude>
<exclude>log4j:log4j</exclude>
<exclude>GROUP:A</exclude>
<exclude>GROUP:B</exclude>
</dependencySet>
</dependencySets>
</assembly>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] assembly and use of dependencySet excludes
Posted by Stefano Fornari <st...@gmail.com>.
If instead you want to do the opposite, unpacking a dependency but avoid to
copy the artifact under lib, you can just add a dependencySet with an
<exclude> for the artifact you do not want.
For example, let's say in the pom you have:
<dependency>
<artifactId>connector-testing-framework</artifactId>
<groupId>funambol</groupId>
<version>7.0.0</version>
<type>tar.gz</type>
</dependency>
In your assembly you need:
<dependencySet>
<outputDirectory>(whatever)/lib</outputDirectory>
<excludes>
<exclude>funambol:connector-testing-framework</exclude>
</excludes>
</dependencySet>
<dependencySet>
<outputFileNameMapping></outputFileNameMapping>
<outputDirectory></outputDirectory>
<includes>
<include>funambol:connector-testing-framework</include>
</includes>
<unpack>true</unpack>
</dependencySet>
If you miss the first dependencyCet, in addition to having the dependency
unpacked, the tar.gz file will be copied under lib (do not ask me why :) ).
HTH
Ste
On Tue, Jul 18, 2006 at 9:16 AM, Barrie Treloar <ba...@gmail.com> wrote:
> For those that may be trying to work out how excludes works I'm
> posting to the list.
>
> There is probably a JIRA issue (I haven't looked) that will address
> pattern matching of excludes, there are comments in the code to
> indicate that this would be a good feature.
>
> To summarize my problem:
> I have a module called <project>-build which creates an assembly of
> all the other modules so that this can be given to our test team in
> one go. The problem I am having is that the assembly is not only
> copying the *-bin.zip files but also the *.jar files even though the
> dependency is only on the zip file.
>
> My pom has this in it:
> <dependencies>
> <dependency>
> <groupId>GROUP</groupId>
> <artifactId>A</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <classifier>bin</classifier>
> <type>zip</type>
> </dependency>
> <dependency>
> <groupId>GROUP</groupId>
> <artifactId>B</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <classifier>bin</classifier>
> <type>zip</type>
> </dependency>
> <dependency>
> <groupId>GROUP</groupId>
> <artifactId>C</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <type>ear</type>
> </dependency>
> </dependencies>
>
> To work around this, I am excluding the jars using the assembly below:
>
> <assembly>
> <id>bin</id>
> <formats>
> <format>dir</format>
> </formats>
> <includeBaseDirectory>false</includeBaseDirectory>
> <dependencySets>
> <dependencySet>
> <unpack>false</unpack>
> <excludes>
> <!--
> There is little documentation on this format.
> It is of the form of DefaultArtifact.getDependencyConflictId()
> which is <groupId>:<artifactId>:<type>:<classifier>
> or you can use the short form (hard coded into assembly) of
> <groupId>:<artifactId>
> This is a String equality match not a pattern match.
> -->
> <exclude>commons-lang:commons-lang</exclude>
> <exclude>log4j:log4j</exclude>
> <exclude>GROUP:A</exclude>
> <exclude>GROUP:B</exclude>
> </dependencySet>
> </dependencySets>
> </assembly>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Ste