开发者

Maven and native libraries

I use maven in my java project, and I don't u开发者_开发问答nderstand how to add in native libraries. In my non-maven project I did it via CLASSPATH. I use NetBeans and maven in my current java project.


If you just want to add the native libraries to the class path, try to put them in src/main/resources.

Update: You can specify where resources exist in the POM:

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <build>
    ...
    <resources>
      <resource>
        <filtering>false</filtering>
        <directory>${basedir}/src/main/native</directory>
        <includes>
          <include>native.so</include>
        </includes>
      </resource>
    </resources>
    <testResources>
      ...
    </testResources>
    ...
  </build>
</project>

But honestly, if you decide to use Maven, you should adopt Maven's standard layout (or you'll have to configure every plugin for your custom layout which is more a source of problems than benefits).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜