<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>com.XXXX.XXXXOfflineApp</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
I have the above code piece to create an jar with dependencies, but in my pom i also have some dependencies with scope provided but these are not included in the uber jar, Well I cannot change the scope of those dependencies because the regular jars build should not include them.Since those are provided by the container.
Try adding an assembly.xml file like this:
Adding any dependencySet you need for each scope.
You'll also need this in your pom.xml
The predefined
jar-with-dependencies
descriptor unpacks all dependencies needed at runtime into the root of the produced JAR. If you want to add provided dependencies, it is possible to build on it and add a specific<dependencySet>
with<scope>provided</scope>
.This will include all dependencies normally needed at runtime (so having a scope of
compile
andruntime
) and all dependencies having theprovided
scope.You would configure the use of this descriptor format with:
where
path/to/assembly.xml
corresponds to the path to the above descriptor format, relative to the location of the POM.I was also working on creating a distribution file, I did some thing like below assembly.xml
distribution.xml
In parent pom.xml