Maven Exec Plugin not reading configuration

拟墨画扇 提交于 2019-12-05 16:35:19

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 executing mvn 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 the pluginsManagement element. If that fails, post your entire POM.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <executable>java</executable>
        <workingDirectory>/target</workingDirectory>            
        <arguments>
            <argument>-jar</argument>
            <argument>${project.build.directory}/${project.build.finalName}.jar</argument>
        </arguments>          
    </configuration>
</plugin>

Try putting the configuration inside the execution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!