HairOfTheDog
HairOfTheDog

Reputation: 2737

How to get Maven to do only my custom profile?

I have Maven configured with a custom profile to run my Spring Boot application. Most of the time I want to build and run my project. I do so like this: mvn clean install -Drun. But sometimes when testing things out I just want to re-run without rebuilding the project. I'd like to do something like mvn -Drun but Maven complains that no goals have been specified.

How can I get Maven to execute my custom profile without rebuilding, repackaging, etc?

p.s. I'm running Apache Maven 3.3.9

Upvotes: 0

Views: 437

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35843

This is not how Maven works.

You cannot "run" a profile. A profile is just a part of the POM that you can switch on and off.

You can run single Maven plugin goals (like dependency:list). They will pick up their configuration from the POM, possibly from a profile.

Alternatively, you can run phases (i.e. a lifecycle up to a given phase, like when you call mvn install it runs the standard lifecycle up to the phase install).

Upvotes: 1

Related Questions