I am trying to use the Maven assembly plugin to build a jar-with-dependencies, except those that have provided scope.
I have copied the jar-with-dependencies into an assembly.xml file and configured its use in my pom. Here it is for reference:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>injectable-jar</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
</fileSet>
</fileSets>
</assembly>
I have found out, that if I set the scope to provided
, then I can build a jar that contains exactly what I don't want, but I cannot figure out how to get inverse behavior of that.
test
-scoped dependencies. – Augustintest
-scoped dependencies. In what way can that possibly be a sane default, I wonder? – Augustinjar-with-dependencies
don't include provided scope by default. – Tigress<scope>runtime</scope>
by default. For me that seems to exclude all dependencies marked with<scope>provided</scope>
, along with their transitive dependencies, as expected. Is that not the behavior you wanted? Have you tried the latest version of the plugin, currently v3.6.0? – Grayson