Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does IntelliJ Build > Rebuild Project invoke maven?

In IntelliJ 14.1 what exactly happens when Build > Rebuild Project is invoked for a maven project.

  • Does it call mvn compile?
  • Does it do something independent of maven?

I have tried to testing this and when I click Build > Rebuild Project I can't see any console output indicating that maven is running, if I run maven from the maven projects view I get maven output.

So what exactly is the relationship between IntelliJ Build > Rebuild Project and build tools such as maven / gradle / ant?

like image 541
ams Avatar asked Apr 04 '15 20:04

ams


People also ask

What does IntelliJ rebuild project do?

Rebuild When you execute a rebuild command, IntelliJ IDEA cleans out the entire output directory, deletes the build caches and builds a project, or a module from scratch. It might be helpful, when the classpath entries have changed. For example, SDKs or libraries that the project uses are added, removed or altered.

What is the difference between build and rebuild in IntelliJ?

Basically, "Build Artifact" is a conditional build, meaning it will only build if there is any modified code. If you haven't changed anything, it won't do anything. "Rebuild Artifact", however, will force a build from scratch no matter if there are code changes or not.

How does IntelliJ work with Maven?

IntelliJ IDEA supports a fully-functional integration with Maven that helps you automate your building process. You can easily create a new Maven project, open and sync an existing one, add a Maven support to any existing IntelliJ IDEA project, configure and manage a multi-module project.


1 Answers

No, the IntelliJ IDEA make does not invoke Maven. When you open a Maven or Gradle project, it reads the settings of the project and stores them as part of its internal project model. When you invoke Build, it uses the imported settings to compile your project using its own build system. Rebuild Project keeps the existing imported settings, deletes all .class files and IntelliJ's incremental compilation caches, and performs a full build of the project using IntelliJ IDEA's build system.

The advantage of doing that is that the IntelliJ IDEA build system supports very fine-grained incremental rebuilds (for example, if you change the signature of the method, it will recompile only those classes which actually call the method, and not any other code).

Note that you can configure IntelliJ IDEA to run an Ant task or a Maven goal either before or after the main project compilation, so if your build is doing something non-standard, you can still use it with the IntelliJ IDEA build system.

like image 173
yole Avatar answered Sep 21 '22 15:09

yole