Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Assembly includes filtering

Given the following dependency inclusion an a Maven assembly XML...

<dependencySet>
  <includes>
    <include>com.company.product:library:jar:*:*</include>
  </includes>

... why does the above filter fail to include library:jar that doesn't have a classifier?

[INFO] Reading assembly descriptor: assembly/release.xml
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'com.company.product:library:jar:*:*'

The reason for the additional wildcards in my pattern is that I also have a profile that builds all my libraries with the classifier "qa". When I activate that profile, everything works, but under the default profile (which builds libraries with no classifiers) it fails.

If I change the filter to:

<include>com.company.product:library*</include>

Then the maven build actually fails, with this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-
plugin:2.3:single (make-assembly) on project java-package: Failed to create 
assembly: Error adding file 'com.company.product:library:jar:1.0.0-SNAPSHOT' 
to archive: C:\Subversion\JavaProj\library\target\classes isn't a file. -> [Help 1]

Can someone suggest a pattern that will include jars either with or without a classifier?

like image 618
RCross Avatar asked Oct 10 '12 15:10

RCross


2 Answers

check your <dependencies> in pom.xml: is the dependency you refer in the assembly-xml also there?

like image 100
Gambotic Avatar answered Nov 28 '22 00:11

Gambotic


Faced with same problem. Do not know why, but maven-assembly-plugin does not include dependencies with compile scope which is default. Making it as provided fixes assembling.

E.g. check your com.company.product:library dependencies and try to add <scope>provided</scope> to them. Then instead of * try to list all libraries manally. (You could also try with one of them to check the solution)

like image 23
Cherry Avatar answered Nov 27 '22 22:11

Cherry