Hello,
 
I’m trying to invoke my custom plugin “i18nMessageCompiler” whenever a properties file in the src/main/resources directory changes (e.g. when a new property is added). How do I configure the pom.xml or m2e to invoke the plugin whenever
 the properties file changes?
 
In the lifecycle-mapping, I configured the plugin to run on incremental build. One issue might be that Eclipse does not trigger an incremental build when files in src/main/resources change. However, even if I change a Java class in src/main/java
 (which should invoke an incremental build), the i18nMessageCompiler plugin execution does not get invoked.
 
Only a full project rebuild via Eclipse’s > Project > Clean (with “Start a build immediately” checked) will invoke the plugin execution.
 
 
Excerpt from the project’s pom.xml:
 
<build>
   <finalName>rts</finalName>
   <plugins>
 
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
         <version>2.3</version>
         <configuration>
            <warSourceExcludes>node_modules/**</warSourceExcludes>
         </configuration>
      </plugin>
 
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.1</version>
         <configuration>
            <source>1.8</source>
            <target>1.8</target>
         </configuration>
      </plugin>
 
      <plugin>
         <groupId>com.rfxcel.rts</groupId>
         <artifactId>i18nMessageCompiler</artifactId>
         <version>1.0.0</version>
         <configuration>
            <fullyQualifiedClassName>com.rfxcel.rts.ui.messages.MessageIds</fullyQualifiedClassName>
            <propertiesFileName>messages.properties</propertiesFileName>
            <messageIdFormat>RTSUI\d{5}(I|W|E)</messageIdFormat>
         </configuration>
         <executions>
            <execution>
               <phase>generate-sources</phase>
               <goals>
                  <goal>compileMessages</goal>
               </goals>
            </execution>
         </executions>
      </plugin>
   </plugins>
 
   <pluginManagement>
      <plugins>
         <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
         <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
               <lifecycleMappingMetadata>
                  <pluginExecutions>
                     <pluginExecution>
                        <pluginExecutionFilter>
                           <groupId>com.rfxcel.rts</groupId>
                           <artifactId>i18nMessageCompiler</artifactId>
                           <versionRange>[1.0.0,)</versionRange>
                           <goals>
                              <goal>compileMessages</goal>
                           </goals>
                        </pluginExecutionFilter>
                        <action>
                           <execute>
                              <runOnIncremental>true</runOnIncremental>
                              <runOnConfiguration>true</runOnConfiguration>
                           </execute>
                        </action>
                     </pluginExecution>
                  </pluginExecutions>
               </lifecycleMappingMetadata>
            </configuration>
         </plugin>
      </plugins>
   </pluginManagement>
</build>
 
 
Thank you,
 
Ben Emery-Honzal