My Java EE proj builds fine, but when trying to execute get following error:
gert@gert-VirtualBox:~/workspace/CDBOOKSTORE$ mvn exec:java
[INFO] Scanning for
If the <configuration>
is outside the <executions>
, it is the configuration for the plugin to be used no matter what the life-cycle phase is.
If the <configuration>
is inside the <executions>
, it is the configuration to be used in certain life-cycle phase.
As Vabis has suggested, use mvn exec:java@someID
to execute the specific execution of the goal for a plugin.
For more information, please see https://maven.apache.org/guides/mini/guide-configuring-plugins.html.
There is no such parameter like mainClass
in exec-maven-plugin, try to use:
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.aptovia.javaee7.CDBOOKSTORE.Main</argument>
</arguments>
</configuration>
"configuration" must go outside "executions", like this:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.emilio.App</mainClass>
</configuration>
</plugin>
</plugins>
Configuration seems correct with missing id parameter inside execution part. Proper way would be:
<executions>
<execution>
<id>someID</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.aptovia.javaee7.CDBOOKSTORE.Main</mainClass>
</configuration>
</execution>
</executions>
Assuming you are running main method using maven, execution would be like below:
mvn exec:java@someID
someID added inside execution part.
Make sure you execute the mvn exec:java
from within the same directory where your pom.xml
with exec configuration resides.