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

时间:2022-03-19 13:30:58

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? 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会打电话给maven吗?他们两个都将源代码编译到同一个地方吗?他们都复制资源文件吗?为什么我们需要两种选择? intellij是否自动下载依赖项,我们只需调用项目make,而不使用maven编译?

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

3 个解决方案

#1


21  

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来处理项目的依赖项。

#2


2  

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. Then you have to compile B in A.

如果您更改了B项目,则必须在A上更新此项目。然后您必须在A中编译B.

But if you had changed only A you dont have to compile Maven.

但如果你只改变了A,你就不必编译Maven。

#3


2  

No, IntelliJ doesn't call maven, but get all information from the pom.xml e.g. output directories libraries etc.

不,IntelliJ不会调用maven,而是从pom.xml获取所有信息,例如:输出目录库等

So don't worry, you can call make from IntelliJ for compiling and running your application. If you have some special goals in your maven build file you can run it from the maven window.

所以不用担心,您可以从IntelliJ调用make来编译和运行您的应用程序。如果您在maven构建文件中有一些特殊目标,则可以从maven窗口运行它。

All maven dependencies will be downloaded from IntelliJ an stored in the maven local repository.

所有maven依赖项都将从存储在maven本地存储库中的IntelliJ下载。

#1


21  

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来处理项目的依赖项。

#2


2  

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. Then you have to compile B in A.

如果您更改了B项目,则必须在A上更新此项目。然后您必须在A中编译B.

But if you had changed only A you dont have to compile Maven.

但如果你只改变了A,你就不必编译Maven。

#3


2  

No, IntelliJ doesn't call maven, but get all information from the pom.xml e.g. output directories libraries etc.

不,IntelliJ不会调用maven,而是从pom.xml获取所有信息,例如:输出目录库等

So don't worry, you can call make from IntelliJ for compiling and running your application. If you have some special goals in your maven build file you can run it from the maven window.

所以不用担心,您可以从IntelliJ调用make来编译和运行您的应用程序。如果您在maven构建文件中有一些特殊目标,则可以从maven窗口运行它。

All maven dependencies will be downloaded from IntelliJ an stored in the maven local repository.

所有maven依赖项都将从存储在maven本地存储库中的IntelliJ下载。