简体   繁体   English

intellij Project make和Maven Compile之间的区别?

[英]Difference between intellij Project make and Maven Compile?

When working in maven module, what's the difference between doing in intellij build -> Make Project and Maven Projects -> Root pom -> Compile phase. 在maven模块中工作时,在intellij build - > Make Project和Maven Projects - > Root pom - > Compile阶段之间有什么区别。

Does intellij calls maven? intellij会打电话给maven吗? Does both of them compile the sources to the same place? 他们两个都将源代码编译到同一个地方吗? Do they both copy resources files? 他们都复制资源文件吗? Why do we need both options? 为什么我们需要两种选择? Does intellij download the dependencies automatically and we can just call project make, without using maven compile? intellij是否自动下载依赖项,我们只需调用项目make,而不使用maven编译?

intellij项目:两种编译方式

They are actually quite similar in terms of the task they perform which is to compile the source and test paths of the project with javax.tools.JavaCompiler by default. 它们在执行的任务方面实际上非常相似,默认情况下使用javax.tools.JavaCompiler编译项目的源和测试路径。

Does intellij call maven? intellij会打电话给maven吗?

No it doesn't by default. 不,它不是默认的。 Remember that this is just IntelliJ's built in Java compiler and some Java projects don't use maven. 请记住,这只是IntelliJ内置的Java编译器,而一些Java项目不使用maven。

Does both of them compile the sources to the same place? 他们两个都将源代码编译到同一个地方吗?

Yes, they use the same source files to compile if that's what you are asking here. 是的,他们使用相同的源文件进行编译,如果这是你在这里问的那个。

Do they both copy resources files? 他们都复制资源文件吗?

Yes they both copy the resource files to different locations though. 是的,他们都将资源文件复制到不同的位置。

Why do we need both options? 为什么我们需要两种选择?

We don't need both options. 我们不需要两种选择。 Maven compile command checks the source code against any syntactical errors which effectively covers the work done by IntelliJ's make option. Maven编译命令检查源代码是否存在任何语法错误,这些错误有效地涵盖了IntelliJ的make选项所做的工作。

Does intellij download the dependencies automatically and we can just call project make, without using maven compile? intellij是否自动下载依赖项,我们只需调用项目make,而不使用maven编译?

Intellij's compiler can be considered as syntax compiler which is why you need maven to handle your project's dependencies. Intellij的编译器可以被视为语法编译器,这就是为什么你需要maven来处理项目的依赖项。

No, IntelliJ doesn't call maven, but get all information from the pom.xml eg output directories libraries etc. 不,IntelliJ不会调用maven,而是从pom.xml获取所有信息,例如输出目录库等。

So don't worry, you can call make from IntelliJ for compiling and running your application. 所以不用担心,您可以从IntelliJ调用make来编译和运行您的应用程序。 If you have some special goals in your maven build file you can run it from the maven window. 如果您在maven构建文件中有一些特殊目标,则可以从maven窗口运行它。

All maven dependencies will be downloaded from IntelliJ an stored in the maven local repository. 所有maven依赖项都将从存储在maven本地存储库中的IntelliJ下载。

Let's think we have a Project A which is use Maven Project B . 我们认为我们有一个使用Maven Project B项目A.

If you had changed B project you have to update this project on A . 如果您更改了B项目,则必须在A上更新此项目。 Then you have to compile B in A . 然后你必须在A中编译B.

But if you had changed only A you dont have to compile Maven. 但如果你只改变了A,你就不必编译Maven。

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

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