native-maven-plugin在“a”包装类型上失败

时间:2014-11-27 01:12:50

标签: maven native-maven-plugin

我无法完成使用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”,但没有区别,它仍然以“Unknown packaging”失败。

这是我的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>

1 个答案:

答案 0 :(得分:0)

好的,我明白了。该插件需要&#39;扩展程序&#39;要设置为true的标记,所以pom.xml现在包含&#34; <extensions>true</extensions>&#34;,如:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <extentions>true</extensions>
    <version>1.0-alpha-8</version>
    ...
</plugin>

Mojo Native Maven Plugin Usage页面中提到了这一点。