c++ - 未知包装 nar - nar-maven-plugin

标签 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,但它没有改变任何东西。

最佳答案

当插件添加新的包装类型时,必须添加<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>

关于c++ - 未知包装 nar - nar-maven-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34085370/

相关文章:

c++ - 为什么我可以使用初始化列表来构造对象?

java - Jenkins Sonar 扫描仪与 Maven Sonar :sonar goal

c - 表达式必须是可修改的值

c++ - 给定 N 个输入和 p,q 的算法 : find max Xor in array for various interval limis,,其中 0<=p<=i<=q<=N

指向不完整类型的指针可以不完整吗?

android - "ndk-build finish with non-zero exit value 2"编译 textfairy 项目时

java - Idea Intellij : Dependency org. json :json:20180813 not found,无法在maven中导入org.json库

c++ - mkl cblas_dgemm 参数错误

c++ - 与 C++ 中的覆盖混淆

c++ - C++中删除数据的命名约定