I have a JPA project and as part of my maven build I am enhancing the classes. In eclipse have auto build enabled and in my pom.xml I have configured m2e to execute the ehance goal to run as part of the build. This all seems to work fine except for one issue. After the enhancer has run, the class files are out of sync with eclipse. This is a problem because if i try to publish to a server I get an error like "Resource is out of sync with the file system: '/my-project/target/classes/com/xyz/entity/MyEntity.class'.". I can't seem to manually refresh the classes either, so I'm stuck at this point, not being able to publish to the server.
If i configure eclipse to auto Refresh resources automatically (windows->preferences->General->Workspace->(Refresh using native hooks or polling | Refresh on Access) ), then i get into a never ending build cycle loop. It builds, runs the enhancer which updates the class files, reloads the class files which triggers another auto build, and so on, building forever.
Could the m2e plugin update the eclipse resources after the maven builder has executed, so that eclipse is then in sync with the class files that could potentially get modified by the maven builder?
The relevent sections of the pom.xml for my project are as follows...
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>openjpa-maven-plugin</artifactId> <version>1.2</version> <configuration> <includes>**/entity/*.class</includes> <excludes>**/entity/*_.class,**/entity/*$*.class</excludes> </configuration> <executions> <execution> <id>enhancer</id> <phase>process-classes</phase> <goals> <goal>enhance</goal> </goals> </execution> </executions> </plugin>
<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>org.codehaus.mojo</groupId> <artifactId> openjpa-maven-plugin </artifactId> <versionRange>[1.2,)</versionRange> <goals> <goal>enhance</goal> </goals> </pluginExecutionFilter> <action> <execute/> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement>
|