Intellij IDEA automatically resolving all maven dependencies - maven

Since I'm working with a HUGE project, I would like to add maven modules one by one when I'll be in need to.
Unfortunately, Intellij IDEA is resolving all maven dependencies right after project import. Is there any way to stop this, or shutdown automatic resolve right after import?

Intellij Idea has an option in the Maven preferences for controlling this.
Preferences
Build, Execution, Deployment
Build Tools
Maven
Importing
Uncheck the box for "Import Maven projects automatically"

Related

IntelliJ Idea doesn't place dependencies in External Libraries Folder

Currently have a hard times working on one project. While building with maven I'm getting success but when I open the project all classes are red with unresolved dependencies and folder "External Libraries" contains only JDK classes.
Does anyone know what might be the reason of this?
Thanks in advance.
I'm using Intellij Idea 14.0.2 and Maven version 3.2.5
Enable auto reload for your pom file(s). intelliji doesn't do it automatcally unless you enable it.
To do so, just open a pom file and you'll see a popup that asks you if you to enable auto relaod.

Add a remote Archetype Catalog in IntelliJ

I am new to IntelliJ but coming from Eclipse I expected Maven support to be far better. It really is but I could not find how to define a remote archetype catalog in IntelliJ (14.1).
All I could find was a way to add a Archetype manually but that is not what I need. I would like to point to a XML file on a remote server that contains the list of all archetypes available.
In Eclipse, it looks like this :
Maybe you would like to try an Intellij Plugin that I wrote yesterday. It enables you to add remote archetype catalogs to Idea: Maven Archetype Catalog plugin
To make my answer more clear: I had the same issue that it struggles me that you can add Maven Archetype Catalog files in Eclipse, but not in IntelliJ IDEA. So I tried to write a plugin for IntelliJ IDEA, so that you can actually define URLs to archetype-catalog.xml.
The plugin just parses those URLs and provides the Maven Archetypes to the list of available Archetypes in IntelliJ IDEA.
After installing the Plugin you can find a new entry in the Settings menu at File - Settings - Build, Execution and Deployment - Build tools.
I know this is kinda old thread, but in the future if some one will look for it.
This Maven Archetype Catalogs is a plugin for intellij that allows import external archetypes from a URL.
It solved my problem on Linux, haven't tried it on Windows.
To add this plugin go to File->Settings->Plugins->Browse repositories
in the search bar type "Maven Archetype Catalogs". Install and restart.
To use it go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven Archetype Catalogs. click the '+' and add the archetype-catalog
It seems that there is a plugin to do this - Maven Archetypes. The reviews are not favourable, and I have never used it though so cannot comment to its effectiveness.
You could also (assuming Windows/IntelliJ 14), edit C:\Users\<username>\.IntelliJIdea14\system\Maven\Indices\UserArchetypes.xml and add the archetypes manually. Not ideal, but still workable.
Screenshots are made in IDEA 14, I've also checked IDEA 13, it's also true for it.
If this is what you need
Then it's in the Preferences:

IntelliJ maven lifecycle - can I modify "Basic Tasks Only" list?

In the IntelliJ Maven Projects tree-view pane, you can see the Lifecycle tasks for all of the maven modules.
By default, these show "Basic Tasks Only". I can untick this, but then I see everything.....
Is it possible to add just one task (integration-test) to the "Basic Tasks Only" list?
i.e. can the IntelliJ Maven Integration plugin be configured?
Or can I write my own plugin to configure this at runtime?
Any tips appreciated. IntelliJ 12.1.4.
Maven plugin is not configurable like this, it is either showing only basic phases or full lifecycle.
A typical workaround for your use case would be to create a Maven run configuration based on the phase you want to launch.
If you really want to fine grain the visible phases inside the Maven tool window, you would have to modify the IntelliJ Community Edition, whose code is available, patches are always welcome by JetBrains.

How to make the "Make Project" menu to run maven goal in IntelliJ?

Now our Maven Java projects generate a lot errors in IntelliJ but maven compiles them fine. Our IntelliJ projects is imported from the pom.xml files. So I want to remove those errors by using maven goal to run the Make Project in the Build menu instead of the built-in one. How do I do that?
Every time you modify the pom.xml file into IntelliJ, an information box usually comes up asking you if you want to re-import your dependencies. Click on it and your errors will disappear.

Using maven's --also-make option in IntelliJ

You can set several properties and configuration options in a Maven build within IntelliJ, but I haven't quite figured if you are able to specify options that are available on the command line such as --also-make or --also-make-dependents.
Is there a way to have those options used by Maven run configurations in Intellij?
You can create a run/debug configuration by right-clicking any goal in the Maven Projects view, select Create your-project[your-goal] and from there you can add any command-line parameters (such as --also-make). Your configuration will be saved and accessible from a single click on the green arrow :).
You can put --also-make into the per-project .mvn/maven.config file which sets command-line options to always apply.
In combination with IntelliJ's option to "Delegate IDE build/run actions to Maven" (which seems to be default when importing Maven projects these days), this gets building and running with the IDE's main buttons and menu items working. No more failures to resolve inter-module dependencies or failing Enforcer.
There may be undesirable side effects to always including --also-make but so far I haven't encountered them—in a multi-module project using the Reactor this way is just about always what I want, so it saves typing on the CLI too.
Side note: I still find #Bastien Jansen's answer useful for invoking other run-like Maven goals, like spring-boot:run with IDEA Community Edition which does not have the more first-class support for Spring Boot applications that Ultimate does.

Resources