I have a problem with maven profiles. Coming to the details, I have two profiles, such as profile1 and profile2. I declared several properties for both profiles, along with modules that need to be updated for each profile separately. Check out the configuration below.
<profiles> <profile> <id>profile1</id> <properties> <owner>ABC</owner> </properties> <modules> <module>module1</module> <module>module2</module> </modules> <profile> <profile> <id>profile2</id> <properties> <owner>XYZ</owner> </properties> <modules> <module>module3</module> <module>module4</module> </modules> <profile> </profiles>
Returning to the point, the profile1 property of ABC should be updated in module1, and the module2 property and XYZ profile2 property should be updated in module 3 and module4. When creating the application, I tried the following commands:
mvn clean install -Pprofile1,profile2 mvn clean install -P profile1,profile2
when I use the above commands to create a project, XYZ has an update in all modules. Similarly, when I use the commands below, ABC updates all 4 modules.
mvn clean install -Pprofile2,profile1 mvn clean install -P profile2,profile1
My requirement is to update ABC only in modules 1 and module2, XYZ in module3 and module4. Please tell me any solution that will solve this problem.
Note. I even tried to run the command below, mvn clean install -Pprofile1 -Pprofile2 The assembly failed with a target or life cycle problem.
-Thanks
maven maven-profiles
Subbareddy
source share