[英]How to add external jar files to maven shade plugin
I am using the maven shade plugin to create shade jar file, in that jar the jars under Maven Dependencies library are get included, so along with that I want the jar under lib folder also get included. 我正在使用Maven阴影插件创建阴影jar文件,其中包含了Maven Dependencies库下的jar,因此我也希望包含lib文件夹下的jar。 The following is the project structure.
以下是项目结构。 please suggest any solution.Thanks in advance.
请提出任何解决方案。谢谢。
The plugin I used as :
我用作的插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>spg_getperson</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jar-with-dependencies</shadedClassifierName>
<filters>
<filter>
<artifact>tibjms:tibjms</artifact>
<includes>
<include>${pom.basedir}/lib/tibjms.jar</include>
</includes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.uprr.app.spg.components.xmfservice.peoplesoft.GetPersonDataService</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.tooling</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Plugin "maven-shade-plugin" takes only maven dependencies. 插件“ maven-shade-plugin”仅接受maven依赖项。 You can install all non-maven libs in local (or remote) maven repository with maven-install-plugin:
您可以使用maven-install-plugin将所有非非Maven库安装在本地(或远程)Maven存储库中:
http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
Smth. 水木清华。 like:
喜欢:
mvn install:install-file -Dfile=sample.jar -DgroupId=org.sample -DartifactId=sample -Dversion=1.0.0 -Dpackaging=jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.