【发布时间】:2014-07-23 13:46:36
【问题描述】:
我必须在我的项目中添加一个 JNI 模块。
我在 Maven 中将模块安装为两个不同的工件:jar 库:
mvn install:install-file -DgroupId=com.test -DartifactId=ssa -Dversion=1.0 -Dpackaging=jar -Dfile=ssa.jar
以及带有 DLL 的运行时库
mvn install:install-file -DgroupId=com.sirio -Dpackaging=ddl -DartifactId=ssa-runtime -classifier=windows-x86 -Dversion=1.0 -Dfile=SSADll.dll
在我的 maven 项目中,我添加了这些依赖项:
<dependency>
<groupId>com.test</groupId>
<artifactId>ssa</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>ssa-runtime</artifactId>
<classifier>windows-${arch}</classifier>
<type>dll</type>
<version>1.0</version>
<scope>runtime</scope>
</dependency>
我的问题是当我运行 shade 插件目标以创建一个具有依赖项的 jar 时,我收到错误:
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project ....: Error creating shaded jar: error in opening zip file sirio\ssa-runtime\1.0\ssa-runtime-1.0-windows-x86.dll
如何告诉shade插件不要解压dll?
【问题讨论】:
-
maven-shade-plugin 旨在遮蔽像压缩文件一样的 jar 文件,这就是错误显示的内容。除此之外你不能。您可以将您的 dll 打包成一个简单的 jar 文件,这应该可以解决问题。
-
@khmarbaise 如果你解释一下如何做到这一点,它可能会很有用。
-
遇到和OP一模一样的问题,很想知道怎么解决。