Maven Assembly includes filtering

Given the following dependency inclusion, Maven's XML compilation ...

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

... why this filter does not include the library: jar, which does not 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 template is that I also have a profile that creates all my libraries with the qa classifier. When I activate this profile, everything works, but under the default profile (which builds libraries without classifiers) it fails.

If I changed the filter to:

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

Then the maven build actually fails:

 [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 template that will include banks with and without a classifier?

+4
source share
3 answers

check <dependencies> in pom.xml: is there a link that you link in assembly-xml?

+7
source

I believe that com.company.product:library* fails because you need a colon: com.company.product:library:* (see this chapter from Maven: full reference ).

However, instead of banging my head about these wildcards, I suggest creating different component descriptors for your two profiles β€” qa and non-qa β€” for the two build profiles. One list of dependencies that have a classifier, one of which lists dependencies without a classifier.

Of course, an XML file and some redundant content will be distributed, but it will solve your problem.

0
source

Faced with the same problem. I don’t know why, but the maven-assembly-plugin has no include dependencies with the default compile scope. Make it as provided fixes the assembly.

eg. check your com.company.product:library dependencies and try adding <scope>provided</scope> . Then, instead of * try to list all the libraries on a small scale. (You can also try checking the solution with one of them)

0
source

Source: https://habr.com/ru/post/1438954/


All Articles