user1448458
user1448458

Reputation:

Custom Maven goals in IntelliJ IDEA

I am trying to find the way to configure the custom maven goals in IntelliJ. For e.g. I want the custom goal to be: clean install -U and I want to name it: update, but I can't find how to configure this in IntelliJ. Is this even possible? If so how can I do this?

Upvotes: 20

Views: 20158

Answers (2)

Nahuel Barrios
Nahuel Barrios

Reputation: 1910

Another way to do that is create a new run/debug Maven configuration. There you can specify the full command line arguments and a lot of other things.

Run\Edit configurations...
Select + (to create a new one)\Maven

Upvotes: 12

Chris
Chris

Reputation: 23171

There are 2 things you can do:

You can right-click your project root in the "Maven Projects" view and select the "Create XXX [install]..." option (where XXX is your project/module name. Then, in the subsequent dialog, specify clean install -U as the command line option. This will create a run configuration that invokes maven (you can name it "update" if you want). While it won't show up in the Maven view, it will be accessible from the normal run/debug configuration.

Alternatively, you can define a new profile in your pom that rebinds "install" to "clean install -U". You won't be able to rename it to "update" in the intelliJ ui, but you can at least ensure that both clean and install are run whenever someone runs the install goal.

Upvotes: 15

Related Questions