我使用 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/