我有一个非常简单的 C++ Maven NAR 项目,我想从 CLion 的终端编译它。这是我项目的 pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.app.sample</groupId>
<artifactId>app-sample</artifactId>
<version>1.0</version>
<packaging>nar</packaging>
<build>
<defaultGoal>integration-test</defaultGoal>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
<configuration>
<libraries>
<library>
<type>executable</type>
<run>true</run>
</library>
</libraries>
</configuration>
</plugin>
</plugins>
</build>
</project>
一个简单的 main.cpp:
#include <iostream>
using namespace std;
int main() {
cout << "Hello world" << endl;
return 0;
}
而这个目录结构:
如果我使用“开发人员命令提示符”,我可以编译它。
[INFO] -----------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------
使用 CLion 的终端 (ALT+F12) 构建项目时会出现问题:
E:\...app-sample>mvn compile
...
[INFO] Using AOL: x86-Windows-msvc
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
...
[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.0.0:nar-validate (default-nar-validate) on project app-sample: Cannot deduce version number from: -> [Help 1]
...