如何在maven项目中自动使用libsigar-x86-linux.so配置sigar

时间:2014-11-21 15:52:20

标签: maven sigar

我在maven项目中使用sigar API,我已将sigar maven依赖项和log4j依赖项添加到pom文件中,但是当我构建项目时,它会出现以下错误

DEBUG Sigar  - no libsigar-x86-linux.so in java.library.path
org.hyperic.sigar.SigarException: no libsigar-x86-linux.so in java.library.path

我手动将libsigar-x86-linux.so文件添加到maven本地存储库时修复了错误,如何使用pom文件自动配置?

1 个答案:

答案 0 :(得分:0)

maven依赖插件存在问题。您必须添加.so类型作为包含类型,如下所示:

 <plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>         
        <execution>
            <id>native-dep</id>
            <phase>compile</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <stripVersion>true</stripVersion>
                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                <includeGroupIds>org.hyperic</includeGroupIds>
HERE ->         <includeTypes>dll,so</includeTypes>
            </configuration>
         </execution>
         ...
     </executions>
 </plugin>