maven override execution in profile

 

      <plugins>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>pretty</id>
                  <goals>
                     <goal>compile</goal>
                  </goals>
                  <configuration>
                     <style>PRETTY</style>
                     <module>org.xxx.cdxxxip.xxx.ApplicationDebug</module>
                  </configuration>
               </execution>
               <!--default execution-->
               <execution>
                  <goals>
                     <goal>compile</goal>
                  </goals>
                  <configuration>
                     <style>${gwt.style}</style>
                     <extraJvmArgs>-Xms512m -Xmx1024m -Djava.awt.headless=true</extraJvmArgs>
                     <localWorkers>2</localWorkers>
                     <module>org.xxx.xxx.xxx.Application</module>
                     <!-- HTML Unit mode is needed for the GWT Test Cases so they don't run in manual (user input required) mode. -->
                     <!--<mode>htmlunit</mode>-->
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>

You can set the <phase> of the corresponding execution to something unknown, like none:

 <phase>none</phase> when overriding each execution. 

   <profiles>
      <profile>
         <id>local</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>gwt-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>pretty</id>
                        <!--disable the this execution for local build-->
                        <phase>none</phase>
                     </execution>
                     <execution>
                        <goals>
                           <goal>compile</goal>
                        </goals>
                        <configuration>
                           <style>PRETTY</style>
                           <module>org.xxx.xxx.xxx.ApplicationLocal</module>
                        </configuration>
                     </execution>
                  </executions>
                  <configuration>
                     <extraJvmArgs>
                        <!--
                         Args must be on a single line, otherwise it puts carriage returns in the command.
                         This is being wrapped in CDATA to protect against IDE auto-formatting.
                        -->
                        <![CDATA[-Xms256m -Xmx512m -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:2956,suspend=n,server=y -Dfile.encoding=windows-1252]]>
                     </extraJvmArgs>

                     <!--add this to make local compilation faster but less-optimized, this sets the optimize level to 0. 9 is the max optimization value -->
                     <!--<draftCompile>true</draftCompile>-->
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s