我创建了一个简单的项目,仅用于启动计算器:
<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>test.maven.executable</groupId>
<artifactId>exe1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>TestExe</name>
<description>test execute with maven different excutables</description>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution><!-- Run our version calculation script -->
<id>Version Calculation</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>calc</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
但当我运行:
mvn exec:exec
我收到了错误信息:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'exec:exec'
[0] Inside the definition for plugin 'exec-maven-plugin' specify the following:
<configuration>
...
<executable>VALUE</executable>
</configuration>
-OR-
on the command line, specify: '-Dexec.executable=VALUE'
但我有:
<configuration>
<executable>calc</executable>
</configuration>
“VALUE”必须是什么?我原以为它是可执行文件的名称...
当我像 -Dexec.executable=calc
这样使用 -Dexec.executable=VALUE 时,它可以工作。
另一个问题是,在插件文档中:
exec:exec execute programs and Java programs in a separate process.
但是当我使用 -Dexec.executable=calc 运行时,Maven 等待我关闭计算器!是否有单独的进程?