我无法完成使用 Maven 的 native-maven-plugin 的第一步。我看过一些关于它的并发症的帖子,但我的 pom.xml 在任何之前都失败了:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project mytest:hello:1.0-SNAPSHOT (/home/vagrant/hello-native/pom.xml) has 1 error
[ERROR] Unknown packaging: a @ line 8, column 16
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
注意“未知包装:a”;简而言之,它不喜欢“<packaging>a</packaging>”,但我在其他示例和 Maven 网站上看到了这一点。我试过“so”而不是“a”,但没有区别,“未知包装”仍然失败。
这是我的 pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mytest</groupId>
<artifactId>hello</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>a</packaging>
<name>libHello.a</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>1.0-alpha-8</version>
<configuration>
<compilerStartOptions>
<compilerStartOption>${commonCompilerOptions}</compilerStartOption>
</compilerStartOptions>
<sources>
<source>
<directory>src</directory>
<fileNames>
<fileName>HelloWorld.c</fileName>
</fileNames>
</source>
</sources>
<linkerProvider>ar</linkerProvider>
<linkerStartOptions>
<linkerStartOption>-r</linkerStartOption>
</linkerStartOptions>
</configuration>
</plugin>
</plugins>
</build>
</project>