我将我的spring引导应用程序打包为一个.war文件。然后使用
java -jar MyProj-{version}.war
若要从命令提示符运行它,请执行以下操作。
不,我正在尝试使用'exec-maven-plugin‘执行相同的命令。但是它失败了,出现了以下错误
错误未能在项目org.codehaus.mojo:exec-maven-plugin:1.6.0:java上执行目标org.codehaus.mojo:exec-maven-plugin:1.6.0:java (默认-cli):目标org.codehaus.mojo:exec-maven-plugin:1.6.0:java的参数“mainClass”丢失或->帮助1无效
由于我没有在命令提示符中提供主类,所以我必须提供主类。下面是我的插件。我用命令
exec:java
从eclipse运行它。
插件
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
<configuration>
<arguments>
<argument>-jar</argument>
<argument>${basedir}/target/MyProj-${project.version}.war</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>发布于 2017-10-09 13:07:08
试着添加
<executable>java</executable>进入您的<configuration>并将<configuration>...</configuration>移出<executions/>之外。
https://stackoverflow.com/questions/46647110
复制相似问题