我正在使用maven shade插件来创建阴影jar文件,在那个jar中, Maven Dependencies 库下的jar被包含在内,所以我想要包含lib文件夹下的jar也包括在内。 以下是项目结构。请提出任何解决方案。谢谢。
我使用的插件:
<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>
答案 0 :(得分:1)
插件“maven-shade-plugin”只接受maven依赖项。 您可以使用maven-install-plugin在本地(或远程)maven存储库中安装所有非maven库:
http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
不便。像:
mvn install:install-file -Dfile=sample.jar -DgroupId=org.sample -DartifactId=sample -Dversion=1.0.0 -Dpackaging=jar