IntelliJ IDEA 14.1.0 Help

Working with Build Tools (Maven/Gradle)

IntelliJ IDEA doesn't provide visual forms for editing Maven/Gradle configuration files. Once you've imported/created your Maven/Gradle project, you are free to edit its pom.xml/build.gradle files directly in the editor. Later, you can tell IntelliJ IDEA to synchronize the project model with the changed files on demand, or automatically import changes to the new build files. Any changes to the underlying build configuration will eventually need to be synced with the project model in IntelliJ IDEA.

For operations specific to Maven/Gradle, IntelliJ IDEA provides a Maven Project tool window and a Gradle tool window. Apart from your project structure, these tool windows provide a list of goals/tasks plus a toolbar with the relevant actions.

migration_guide_maven

If you want the IDE to synchronize your changes immediately:

  • For pom.xml, enable the corresponding options in Settings | Build, Execution, Deployment | Build Tools | Maven | Importing | Import Maven projects automatically
  • For build.gradle, enable the corresponding option in Settings | Build, Execution, Deployment | Build Tools | Gradle | Use auto-import.

For manual synchronization, use the corresponding action on the Maven/Gradle tool window toolbar: refresh.

Running goals/tasks

Use the Maven/Gradle tool window to run any project goal/task. When you do, IntelliJ IDEA creates a corresponding run configuration which you can reuse later to run the goal/task quickly.

It's worth mentioning that any goal/task can be attached to be run before a Run Configuration. This may be useful when your goal/task generates specific files needed by the application.

migration_guide_run_before

Both the Maven and Gradle tool windows provide the Run Task action. It runs a Maven/Gradle command similarly to how you'd run it using the console.

Configuring artifacts

If you have WAR artifacts configured in your pom.xml/build.gradle file, IntelliJ IDEA automatically configures the corresponding artifacts in Project Structure | Artifacts.

Note that when you compile your project or build an artifact, IntelliJ IDEA uses its own build process which may be faster, but is not guaranteed to be 100% accurate. If you notice inconsistent results when compiling your project with Make in IntelliJ IDEA, try using a Maven goal or a Gradle task instead.

See Also

Concepts:

Web Resources:

Last modified: 14 July 2015