Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] m2e plugin execution enhances classes but eclipse resources are then out of sync

I use this plugin and it seems to work just fine:
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.2.0-SNAPSHOT</version>

Vlad

On 12/7/2011 6:51 AM, Anthony Fryer wrote:
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>


_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top