简体   繁体   中英

execute war file using exec-maven-plugin

I package my spring boot application as a .war file. Then use the

java -jar MyProj-{version}.war

to run it from command prompt.

No I am trying to execute the same command using 'exec-maven-plugin'. But it is failing with the following error

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project MyProj: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java are missing or invalid -> [Help 1]

I dint provide the main class as I am not providing in command prompt. Following is my plugin. I use command

exec:java

to run it from eclipse.

Plugin

<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>

Try adding

<executable>java</executable>

into your <configuration> and move <configuration>...</configuration> outside of <executions/> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM