1

I am unable to get through the first step of using Maven's native-maven-plugin. I've seen a few posts regarding complications with it, but my pom.xml fails before any of that with:

[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

Notice the "Unknown packaging: a"; in short it doesn't like "<packaging>a</packaging>", yet I see this in other's examples and on the Maven web site. I've tried "so" instead of "a", but no difference, it still fails with the "Unknown packaging".

Here's my 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>
Paul Munsey
  • 109
  • 1
  • 2

1 Answers1

0

Okay, I figured it out. The plugin needed the 'extensions' tag to be set true, so the pom.xml now includes "<extensions>true</extensions>", like:

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

This is mentioned in the Mojo Native Maven Plugin Usage page.

Paul Munsey
  • 109
  • 1
  • 2