vach
vach

Reputation: 11377

IntelliJ to use maven when running the project

Is it possible to force Intellij to use maven pom.xml to compile project and run using artifacts from target directory?

UPDATE:

I'll describe why I need this. There are lot of configurations in maven pom.xml like copying target jar file to some location, post compile aspect weaving. But Intellij does not care about all this, thus I need it to use maven pom.xml to compile and then run.

Upvotes: 0

Views: 199

Answers (2)

Software Engineer
Software Engineer

Reputation: 16100

If you right-click on a lifecycle step (or a group of selected steps) in the maven project window you can choose to execute that step before or after make, rebuild, or run/debug. Further, if you look at the run configuration for your main method you'll see a section of the panel called Before Launch: Make, where you can add arbitrary maven tasks to be invoked before the app is launched. I find this approach preferable to running my app via maven, because it allows easier debugging and doesn't need complex maven command lines.

Upvotes: 2

maczikasz
maczikasz

Reputation: 1133

I usually do this by adding a maven run configuration and execute with the clean install exec:java goals

Upvotes: 3

Related Questions