You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andy DePue <an...@marathon-man.com> on 2007/02/27 18:55:45 UTC

assembly excludes not working?

Short version: I have a module in a multi-module maven build that 
depends on other modules in the same project.  I'd like to merge all 3rd 
party transitive dependencies into a single .jar, but NOT include any 
dependencies from the project in that .jar.  I can't find a way to get 
the assembly plugin to do this.

Long version: I have a multi-module maven build, which produces a .jar 
for each module (this is good).  Now I'd like to merge all 3rd party 
dependencies into a single jar.  I'm deploying my app via webstart, and 
the idea is that the modules of the app will change frequently, so they 
need to be downloaded separately, but 3rd party dependencies will not 
change often, and it is faster to download them all in one merged .jar 
via webstart.  In the end, I want something like this:

  my-app-module1.jar
  my-app-module2.jar
  3rdpartylibs.jar

My master .pom includes a modules section that looks something like this:

<modules>
  <module>my-app-module1</module>
  <module>my-app-module2</module>
  <module>3rdpartylibs</module>
</modules>

The only dependencies declared by the 3rdpartylibs module are on the 
other two modules (my-app-module1, my-app-module2).  I'd like the 
transitive dependency feature of maven to pick up all the other 
dependencies.  I use the assembly plugin with the assembly definition 
below.  The idea is that it will pick up all dependencies, including 
transitive, and then filter out all my project's artifacts via the 
<exclude>com.myGroupId:*</exclude>.  Instead, it includes ALL 
dependencies, including the two modules (which are in the com.myGroupId 
group).  It's as if the <exclude> was completely ignored.

<assembly>
  <id>3rd-party-dependencies</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <excludes>
        <exclude>com.myGroupId:*</exclude>
      </excludes>
      <outputDirectory>/</outputDirectory>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>

I'm new to maven, so I might be missing something here.  Any help is 
appreciated.

Thanks,
  Andy


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


Re: assembly excludes not working?

Posted by Andy DePue <an...@marathon-man.com>.
The problem lies in the wildcards I used.  Wildcards don't seem to work 
as advertised.  Maybe assembly doesn't support simple groupId wildcards 
in the form of groupId:*?  Instead, I have to manually list every single 
module to exclude, which means I'm repeating myself since this list 
mirrors the dependencies I've already declared in the .pom.  I now have 
to remember to update both my .pom and my assembly .xml whenever I add a 
module to the webstart deploy.

  - Andy


Andy DePue wrote:
> Short version: I have a module in a multi-module maven build that 
> depends on other modules in the same project.  I'd like to merge all 
> 3rd party transitive dependencies into a single .jar, but NOT include 
> any dependencies from the project in that .jar.  I can't find a way to 
> get the assembly plugin to do this.
>
> Long version: I have a multi-module maven build, which produces a .jar 
> for each module (this is good).  Now I'd like to merge all 3rd party 
> dependencies into a single jar.  I'm deploying my app via webstart, 
> and the idea is that the modules of the app will change frequently, so 
> they need to be downloaded separately, but 3rd party dependencies will 
> not change often, and it is faster to download them all in one merged 
> .jar via webstart.  In the end, I want something like this:
>
>  my-app-module1.jar
>  my-app-module2.jar
>  3rdpartylibs.jar
>
> My master .pom includes a modules section that looks something like this:
>
> <modules>
>  <module>my-app-module1</module>
>  <module>my-app-module2</module>
>  <module>3rdpartylibs</module>
> </modules>
>
> The only dependencies declared by the 3rdpartylibs module are on the 
> other two modules (my-app-module1, my-app-module2).  I'd like the 
> transitive dependency feature of maven to pick up all the other 
> dependencies.  I use the assembly plugin with the assembly definition 
> below.  The idea is that it will pick up all dependencies, including 
> transitive, and then filter out all my project's artifacts via the 
> <exclude>com.myGroupId:*</exclude>.  Instead, it includes ALL 
> dependencies, including the two modules (which are in the 
> com.myGroupId group).  It's as if the <exclude> was completely ignored.
>
> <assembly>
>  <id>3rd-party-dependencies</id>
>  <formats>
>    <format>jar</format>
>  </formats>
>  <includeBaseDirectory>false</includeBaseDirectory>
>  <dependencySets>
>    <dependencySet>
>      <excludes>
>        <exclude>com.myGroupId:*</exclude>
>      </excludes>
>      <outputDirectory>/</outputDirectory>
>      <unpack>true</unpack>
>      <scope>runtime</scope>
>    </dependencySet>
>  </dependencySets>
> </assembly>
>
> I'm new to maven, so I might be missing something here.  Any help is 
> appreciated.
>
> Thanks,
>  Andy
>
>
> ---------------------------------------------------------------------
> 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