禁用jnilib的部署

时间:2013-08-08 21:44:55

标签: java maven java-native-interface

我的用户一直在用我的库调用易于分发的本机二进制文件。我通过在罐子中分发本地人来实现这一点,extracted at runtime into a temporary directory

但是,maven-native-plugin要求将本机打包为jnilib(OS X),so(Linux)或dll(Windows)。我有my own deploy target打包jar文件,并将其分发到分类器natives下。这需要一个特殊的分类器,这有点烦人。

  1. 如何停用jnilib/so/dll 的部署?
  2. 如何在没有任何特殊分类器的情况下分发我的jar

1 个答案:

答案 0 :(得分:1)

我做了类似的事情,但我将本地库打包在zip文件中。在那之后,在需要它们的工件中,我pull and unpack使用maven dependency plugin的<{3}}:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>    
    <executions>
        <execution>
            <id>unzip</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>foo</groupId>
                        <artifactId>bar</artifactId>
                        <version>1.0.0</version>
                        <type>zip</type>
                        <overWrite>true</overWrite>
                        <includes>**/*.dll</includes>
                        <outputDirectory>${project.build.directory}/natives</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>    
</plugin>

如您所见,我不使用任何分类器。

相关问题