Maven Exec 插件不读取配置
我正在尝试使用 Maven exec:exec 目标执行我的项目,并且尝试使用以下代码片段配置它:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar ${staging.dir}/project.jar</argument>
</arguments>
</configuration>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
当我运行 mvn exec:exec
时,我得到输出:
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
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'
我已经尝试过我能想到的一切都重新组织
但没有任何区别? 该项目是一个 POM,而不是一个 jar。
有任何想法吗?
I'm trying to execute my project using the Maven exec:exec goal and I've tried to configure it with this snippet:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar ${staging.dir}/project.jar</argument>
</arguments>
</configuration>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
When I run mvn exec:exec
I get the output:
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
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'
I've tried reorganising the <plugin>
everyway I can think of but nothing makes any difference? The project is a POM not a jar.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现您的代码有一个问题。 您需要将 -jar 放入其自己的
argument
元素中。 如果不这样做,您将会收到错误。 你的代码的其余部分是准确的。 这是我的一个项目中的一个工作示例。 这会执行执行mvn package
后打包在目标目录中的jar。 如果您仍然遇到相同的错误,我会尝试从本地存储库中删除该插件以获取新的副本。 还要确保插件不在pluginsManagement
元素中。 如果失败,请发布您的整个 POM。I see one issue with your code. You need to put -jar into its own
argument
element. You will get an error if you don't. The rest of your code is dead on acurate. Here is a working example from one of my projects. This executes a jar that is packaged in the target directory after executingmvn package
. If you still get the same error I would try deleting the plugin from your local repository to get a fresh copy. Also ensure that the plugin is not in thepluginsManagement
element. If that fails, post your entire POM.尝试将
配置
放入执行
中。Try putting the
configuration
inside theexecution
.