Search code examples
javaeclipsemavenconfigurationm2eclipse

My first maven example fails (using m2eclipse) : 'mainClass' missing


I am trying to get work this Maven by Example, using Eclipse + m2Eclipse plugin. However, I got this error

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

But I did specify mainClass in this way (screenshot below) with mainClass specified in the Profiles lines. Any idea why I still got wrong? Many thanks.

enter image description here


Solution

  • As the error message says, you are missing the parameter mainClass.

    You have put the parameters in the Profiles part which is the wrong place.

    Press the Add... button and add the parameter and value in the box like this:

    enter image description here

    It should look like this when you press Ok:

    enter image description here