且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven无法运行我的项目:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec

更新时间:2022-03-20 04:17:44

  1. 该错误会任意出现,并且尽管我的代码很可靠,但也造成了很多麻烦.

我做了以下事情:

  • 我在netbeans上关闭了它.
  • 然后通过单击打开项目",选择我的项目,然后打开
  • 只需按一下netbeans中的运行按钮.

我不会构建或清理它.希望对您有帮助.

I would not build or clean build it. Hope that helps you out.

  1. 我注意到发生这种情况的另一个原因.如果将主类移至另一个包,则会出现相同的错误.在这种情况下,您:
    • 右键单击项目">属性">运行"
    • 通过单击浏览"并选择正确设置主类".
  1. I noticed another reason why this happens. If you moved your main class to another package, the same error springs up. In that case you :
    • Right Click Project > Properties > Run
    • Set the "Main Class" correctly by clicking "Browse" and selecting.