Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Maven plugin and calling buildContext.refresh(File)

Hi,


On Mon, Feb 17, 2014 at 5:24 PM, Grzegorz Słowikowski <gslowikowski@xxxxxxxxx> wrote:
Hi All

I have Maven plugin defining custom "play" packaging (for Play!
Framework 1.x http://www.playframework.com/) applications.
In latest release I added M2Eclipse integration
(see
http://maven-play-plugin.googlecode.com/svn/tags/plugin-1.0.0-beta7/play-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml)
I've read about BuildContext usage here:
https://wiki.eclipse.org/M2E_compatible_maven_plugins , but I have some
questions related to this functionality.

1. I wanted to test/debug "buildContext.refresh( someFile )" so I ran
Maven builds inside Eclipse, but I've always had the default
"org.sonatype.plexus.build.incremental.DefaultBuildContext"
implementation when I've debugged my code.
What should I do to get M2Eclipse implementation of BuildContext interface:
org.eclipse.m2e.core.internal.builder.EclipseBuildContext
org.eclipse.m2e.core.internal.builder.EclipseIncrementalBuildContext
?

You want to debug Eclipse itself and not Maven. (If you run with "Run as Maven..." menu, this will not work, this is nearly just like a console maven build , just use project> clean or trigger incremental build)
I usually launch a second eclipse instance from within the first to do that.
 
Look for tutorials on developping Eclipse plugins if you do not know how to do that.



2. Sources and resources are processed by M2E completely differently. Is
calling "refresh" important for sources, resources or both, and why
(why not calling "refresh()" can lead to infinite rebuilds)?


AFAIK, modifications will either not be seen by Eclipse, or if you have automatic refresh of workspace, it will loop ( auto-refresh> found one external modif>rebuild> auto-refresh > found one external modif >... ).


Calling refresh() will inform Eclipse that the modification is part of the current build and not an external one.
You need to call refresh() for all modifications. (or  via  buildContext.newFileOutputStream).


I have some more questions, but I would like to receive responses for
the above two first. Thank you in advance.

Regards

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



--
Adrien Rivard

Back to the top