Reputation: 21
I'm a novice here in maven, I'm trying to shade my plugin to add dependencies in my project. But I can't seems to find a way to use maven shade plugin. I would ask that anyone here would show me some examples and explain for me specifically, thanks.
Upvotes: 2
Views: 5409
Reputation: 1493
Generally plugins are added to the plugins
section of your pom.xml
. You need to specify the groupId, artifactId, and version of the plugin you are trying to use. For maven-shade-plugin
, you can import it in your pom like this:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
This will bind the goals for the Shade plugin to the package
phase. Running mvn package
will produce a shaded JAR.
Source: https://maven.apache.org/plugins/maven-shade-plugin/usage.html
You can view more examples in the links at the bottom of this page: https://maven.apache.org/plugins/maven-shade-plugin/index.html
Upvotes: 1