I have multiple projects loaded into my project structure and they all use different maven profiles. I know I can switch up the profiles using the Maven Projects tab but I would like to assign a specific profile to go along with a specific run configuration.
Open Maven settings. m2 directory where %USER_HOME% represents the user home directory. If settings. xml file is not there, then create a new one. Add test profile as an active profile using active Profiles node as shown below in example.
In the Project tool window, right-click your project and select Add Framework Support. In the dialog that opens, select Maven from the options on the left and click OK. IntelliJ IDEA adds a default POM to the project and generates the standard Maven layout in Project tool window.
You can assign specific profiles via the dialog "Edit Run Configurations". See this screenshot: AFAIK, this profile setting overrides the choice which you select in the maven view of IntelliJ. Thanks for contributing an answer to Stack Overflow!
A Build profile is a set of configuration values, which can be used to set or override default values of Maven build. Using a build profile, you can customize build for different environments such as Production v/s Development environments.
But, in Maven 3, we can actually add profiles to any of three locations: Note that Maven 2 did support a fourth location, but this was removed in Maven 3. We try to configure profiles in the pom.xml whenever possible. The reason is that we want to use the profiles both on our development machines and on the build machines.
Open your POM in the editor. Specify the <profiles> section and declare the profiles. IntelliJ IDEA displays them in the Profiles list of the Maven tool window.
If You have created maven profiles in your pom.xml
, you should be able to see the profiles in right side of Intellij Idea
If there will be multiple profile you can activate one by default
<activation>
<activeByDefault>true</activeByDefault>
</activation>
Or for running specific profile we can select mvn install -Pbuild-profile
You can assign specific profiles via the dialog "Edit Run Configurations". See this screenshot:
AFAIK, this profile setting overrides the choice which you select in the maven view of IntelliJ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With