【发布时间】:2018-08-12 00:12:41
【问题描述】:
我编写了一个简单的 cli 程序,以便在调用时从 CLI 获取输入。我可以通过在 pom.xml 中添加 exec 插件来做到这一点
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mavericks.App</mainClass>
<arguments>
<argument>names.txt</argument>
<argument>expense.txt</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
但是当我尝试通过 cli 调用相同的东西时
mvn exec:java -Dexec.mainClass=“com.mavericks.App” -Dexec.args=“'names.txt' 'expense.txt'”
未知的生命周期阶段“expense.txt”。您必须指定有效的生命周期阶段或目标。帮助将不胜感激。
【问题讨论】:
-
见stackoverflow.com/questions/1335291/…。你试过逗号分隔的参数吗?