未知的包装nar - nar-maven-plugin

时间:2015-12-04 09:50:57

标签: c++ c maven plugins packaging

我使用Maven来管理我的Java项目构建,但有时候我会用C或C ++语言编写项目,我也想使用Maven,这样就可以更容易地管理这些项目。

似乎nar-maven-plugin应该完成这项工作。我试图创建一个HelloWorld项目来测试它。我认为它会非常简单,因为它通常与Maven一起使用。

我的pom.xml

<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sample</groupId>
  <artifactId>helloworld-cplusplus-sample</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>nar</packaging>
  <name>Helloworld</name>
  <build>
    <plugins>
      <plugin>
        <groupId>com.github.maven-nar</groupId>
        <artifactId>nar-maven-plugin</artifactId>
        <version>3.2.3</version>
        <configuration>
            <libraries>
                <library>
                    <type>executable</type>
                </library>
            </libraries>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

我有以下错误

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: nar @ line 7, column 14
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.sample:helloworld-cplusplus-sample:0.0.1-SNAPSHOT (D:\local\workspaces\TEST\HelloWorl
dMaven\pom.xml) has 1 error
[ERROR]     Unknown packaging: nar @ line 7, column 14
[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

我正在使用Maven 3.3.1。

我强制使用“mvn dependency:get ...”在我的本地存储库中下载nar-maven-plugin,但它不会改变任何内容。

2 个答案:

答案 0 :(得分:1)

当插件添加新的包装类型时,您必须在其定义中添加<extensions>true</extensions>

<plugin>
    <groupId>com.github.maven-nar</groupId>
    <artifactId>nar-maven-plugin</artifactId>
    <version>3.2.3</version>
    <extensions>true</extensions> <!-- This needs to be present for a new packaging -->
    <configuration>
        <libraries>
            <library>
                <type>executable</type>
            </library>
        </libraries>
    </configuration>
  </plugin>

答案 1 :(得分:0)

已经回答,;)

  

link.exe是Microsoft Visual Studio的一部分,也就是NAR   通常用于在Windows上编译C ++代码。

尝试

<linker> 
<name>g++</name>
</linker>
如果你有MinGW或MSVS以外的东西,在你的nar插件配置中

相关问题