Skip to main content

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

m2e development environment setup is explained in [1], but it really
boils down to 1) install eclipse sdk 3.8m3 2) install m2e 3) import m2e
sources and test sources.

Make sure you can run all tests in org.eclipse.m2e.tests successfully
before making any changes.

Behaviour behind <execute/> mapping is implemented by
MojoExecutionBuildParticipant, so this is the class you'll likely need
to change.

The patches you submit must go through bugzilla (eclipse legal
requirement) and must come with corresponding tests (m2e project
requirement). The test(s) obviously need to pass with your patch and
fails without it.

I am also not convinced that .class modifications is a common-enough
scenario to deserve separate <modifiesClassFiles> flag, but I would like
to know what other m2e users and developers think about this.

[1] http://wiki.eclipse.org/M2E_Development_Environment

--
Regards,
Igor

On 11-12-07 11:38 PM, Anthony Fryer wrote:
I'm interested in looking at providing a patch for the issue below.
Where do I start?

 > Date: Wed, 7 Dec 2011 22:09:51 -0500
 > From: igor@xxxxxxxxxxxxxx
 > To: m2e-users@xxxxxxxxxxx
 > Subject: Re: [m2e-users] m2e plugin execution enhances classes but
eclipse resources are then out of sync
 >
 > If you are interested in providing a patch that implements this idea,
 > please join m2e-dev@xxxxxxxxxxx and I'll give you some pointers where to
 > start and explain basic requirements to the patches we can accept.
 >
 > --
 > Regards,
 > Igor
 >
 > On 11-12-07 9:16 PM, Anthony Fryer wrote:
 > > It would be nice if you could configure the lifecycle-mappnig to tell
 > > the m2e MavenBuilder that the classes have been modified by a plugin
 > > execution and that it should refresh the class resources in eclipse
 > > without triggering a new incremental build.
 > >
 > > Something like this...
 > >
 > > <action>
 > > <execute>
 > > <modifiesClassFiles>true</modifiesClassFiles>
 > > </execute>
 > > </action>
 > >
 > > I'm just thinkg that might remove the need to create an m2e
extension to
 > > get this to work.
 > >
 > > Cheers,
 > >
 > > Anthony
 > >
 > > > Date: Wed, 7 Dec 2011 07:30:08 -0500
 > > > From: igor@xxxxxxxxxxxxxx
 > > > To: m2e-users@xxxxxxxxxxx
 > > > Subject: Re: [m2e-users] m2e plugin execution enhances classes but
 > > eclipse resources are then out of sync
 > > >
 > > > This is exactly the problem described in [1]. Here is a relevant
quote:
 > > >
 > > > "Out-of-workspace resource changes made by Maven plugin triggered
 > > > unexpected workspace builds. This was very indeterministic. In some
 > > > cases projects appeared to work fine. In some cases,
generated/filtered
 > > > resources would go missing. And in some cases workspace build
would go
 > > > on forever."
 > > >
 > > > You need a proper m2e integration to modify .class files, <execute/>
 > > > mapping will not work.
 > > >
 > > > [1] http://wiki.eclipse.org/M2E_plugin_execution_not_covered
 > > >
 > > > --
 > > > Regards,
 > > > Igor
 > > >
 > > > On 11-12-07 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
 > > > _______________________________________________
 > > > m2e-users mailing list
 > > > m2e-users@xxxxxxxxxxx
 > > > https://dev.eclipse.org/mailman/listinfo/m2e-users
 > >
 > >
 > > _______________________________________________
 > > m2e-users mailing list
 > > m2e-users@xxxxxxxxxxx
 > > https://dev.eclipse.org/mailman/listinfo/m2e-users
 > _______________________________________________
 > m2e-users mailing list
 > m2e-users@xxxxxxxxxxx
 > https://dev.eclipse.org/mailman/listinfo/m2e-users


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


Back to the top