Maven: run a build for multiple profiles in Eclipse
Asked Answered
L

1

6

Let's suppose we have a Maven project in Eclipse. The pom.xml has two profiles.

The question is: how can I run maven in Eclipse in order to execute every goals for each profile?

I tried to:

  • setting active maven profiles in Properties/Maven -> didn't work
  • run maven with: clean install -Pprofile1 -Pprofile2 -> didn't work
  • run maven with: clean install -P profile1,profile2 -> didn't work
  • run maven setting "Profiles" under "Goals" ( profile1,profile2) -> didn't work

I want that maven will run for both profiles, executing all tasks in the pom.xml

Thanks.

Lusatia answered 26/10, 2018 at 7:14 Comment(6)
What is the purpose of those profiles? What are the differences?Stressful
The purpose is: run a build with both profiles. The build itself makes different things on each profile. I simply want to run the build one single time with both profiles and combine the result of the build of profile1 with the build of the profile2Lusatia
sorry but your answer you have written does not answer my question. What is being done for the different profiles? Why are those profiles needed?Stressful
That's not relevant what the build has to do. I simply want to know how can I have in the target folder the result of the build with profile1 with the build of the profile2. Each build produces a "profile1" or "profile2" folder in target. So I want to produce both in the same time.Lusatia
What do you exactly get, if you specify all profiles in the Maven run configuration? As a workaround, the Maven run configurations for the different profiles can be combined in a Launch Group: https://mcmap.net/q/338199/-running-multiple-launch-configurations-at-onceMisstate
If I specify all the profiles, only one is built. The Launch Group function looks interesting.Lusatia
D
0

Here is how you do it Eclipse Config

Dowitcher answered 7/5, 2021 at 21:52 Comment(1)
Giving multiple profiles seperated by a space (which i think you propose) does not work for me. Only the last profile is used.Electrical

© 2022 - 2024 — McMap. All rights reserved.