Why I always need to run "maven clean install" before executing main java code in intellij?

huangapple go评论69阅读模式
英文:

Why I always need to run "maven clean install" before executing main java code in intellij?

问题

我已经在IntelliJ中用Java编写了一些代码。现在,每当我在我的Java代码中进行任何更改并使用绿色运行按钮运行它时,这些更改直到我运行maven clean install命令后才会生效。
所以现在,我必须在执行我的Java代码之前运行maven clean install命令。为什么会出现这种情况,而我朋友的集成开发环境中只需点击绿色运行按钮就可以执行相同的代码。

英文:

I have written some code in intellij in java. Now, whenever I make any changes in my java code and run it using green run button, these changes are not reflected until I run maven clean install.
So right now, I have to run maven clean install before executing my java code. why this is happening, same code is executing just by green run button in my friends IDE.

答案1

得分: 1

当“Rebuild Project”操作委托给Gradle或Maven时,IntelliJ IDEA在重新构建项目时不会包含clean任务/目标。如果需要,在Gradle或Maven工具窗口中使用“在重新构建之前执行”选项,您可以在重新构建之前执行clean命令。更多信息请参阅:
https://www.jetbrains.com/help/idea/work-with-maven-goals.html#trigger_goal

英文:

When the Rebuild Project action is delegated to Gradle or Maven, IntelliJ IDEA doesn't include the clean task/goal when rebuilding a project. If you need, you can execute the clean command before the rebuild using the Execute Before Rebuild option in the Gradle or Maven tool window.
More info here:
https://www.jetbrains.com/help/idea/work-with-maven-goals.html#trigger_goal

答案2

得分: 0

实际问题是另外一回事。
在目标文件夹中,当运行程序时,未生成 .class 文件。

英文:

the actual problem was something else.
In the target folder, .class files was not getting generated when running the program.

huangapple
  • 本文由 发表于 2020年10月27日 17:07:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/64551150.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定