1

I have a 3 maven profiles with plugins:

<profile>
   <id>first</id>
   <build>
     <plugins>
       <plugin>
           ...
        <configuration>
           <var>1</var>
        </configuration>
       </plugin>
     </plugins>
   </build>    
</profile>

<profile>
   <id>second</id>
   <build>
     <plugins>
       <plugin>
           ...
        <configuration>
           <var>2</var>
        </configuration>
       </plugin>
     </plugins>
   </build>    
</profile>

<profile>
   <id>third</id>
   <build>
     <plugins>
       <plugin>
           ...
        <configuration>
           <var>3</var>
        </configuration>
       </plugin>
     </plugins>
   </build>    
</profile>

When i start my build with mvn clean install -P first,second,third -X, I discovered that all this plugins was executed with configuration from from third profile. Is there any way to preserve my configuration for each of my plugins and not to be overriden by third configuration?

user1685632
  • 117
  • 10
  • You probably need 3 different execution for each profile – jmj Apr 28 '15 at 04:33
  • @JigarJoshi what parameters do you exactly mean? i have 3 different of executions (supposedly) like this ? for each plugin in profile of course: ` some_id generate-sources replace ` – user1685632 Apr 28 '15 at 04:38
  • I mean `mvn clean install -P first`, `mvn clean install -P second`, `mvn clean install -P third` – jmj Apr 28 '15 at 04:42
  • 1
    check this http://stackoverflow.com/questions/18152831/building-multiple-maven-profiles-for-a-single-jenkins-job – jmj Apr 28 '15 at 04:44
  • I don't think I can use this solution, because it is a GWT project, i can't afford it to compile several times. But i think about it, maybe it will work somehow. Thanks! – user1685632 Apr 28 '15 at 04:54
  • you don't need to compile both of the time, you can skip compilation in second and third profile – jmj Apr 28 '15 at 04:58
  • @JigarJoshi could you please tell me how? i'm a newbie when it comes to maven. – user1685632 Apr 28 '15 at 05:14
  • 1
    using [`mainSkip`](http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#skipMain) proeprty – jmj Apr 28 '15 at 05:15

1 Answers1

1

As discussed in comments section, You would have to invoke 3 build activating each profile differently

for example

mvn clean install -Pfirst
mvn clean install -Psecond
mvn clean install -Pthird

and to disable compilation in second and third, you could configure maven-compiler-plugin for these profiles and use skipMain property to disable main's source compilation, also for tests

jmj
  • 237,923
  • 42
  • 401
  • 438