简体   繁体   English

我的第一个Maven示例失败(使用m2eclipse):缺少'mainClass'

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

I am trying to get work this Maven by Example , using Eclipse + m2Eclipse plugin. 我正在尝试使用Eclipse + m2Eclipse插件通过示例实现Maven 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 [错误]无法在项目simple-weather上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:java(default-cli):目标org.codehaus.mojo:exec-的参数'mainClass' maven-plugin:1.2.1:java丢失或无效

But I did specify mainClass in this way (screenshot below) with mainClass specified in the Profiles lines. 但是我确实以这种方式(在下面的屏幕截图中)指定了MainClass,并且在Profiles行中指定了mainClass。 Any idea why I still got wrong? 知道为什么我还是错吗? Many thanks. 非常感谢。

在此处输入图片说明

As the error message says, you are missing the parameter mainClass . 如错误消息所述,您缺少参数mainClass

You have put the parameters in the Profiles part which is the wrong place. 您已将参数放在“ Profiles部分中,这是错误的位置。

Press the Add... button and add the parameter and value in the box like this: Add...按钮,然后在框中添加参数和值,如下所示:

在此处输入图片说明

It should look like this when you press Ok : 当您按Ok时,它应该看起来像这样:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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