Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] m2e connector tutorials and/or development resources are lacking.

Yes, all this happens within the context of an Eclipse plugin project, and you have access to all the Eclipse workbench APIs as well as the APIs of all bundles on which your plugin project depends, say org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil.


On Wed, Feb 5, 2014 at 12:45 PM, Thomas Golden <tomrk1089@xxxxxxxxx> wrote:
Norman, thanks for the tips.

So in addition to simply running the Maven plugin goals (i.e. generating sources from the relevant Android XML resources) do I also have access to other aspects of the Eclipse workspace? For example, I need the generated sources output folder to be marked as a source folder in the workspace -- I assume there must be some way to do so, since connectors like Antlr and JAXB do it, but it's not 100% clear to me which class is responsible for that.


On Wed, Feb 5, 2014 at 11:57 AM, Norman Cohen <nhcohen@xxxxxxxxxx> wrote:
Thomas,

As one who has recently struggled with the (lack of) m2e documentation to write my own connector, I feel your pain.

As I understand it, a "connector" is simply a class extending org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant, which you write and hook into the m2e framework as follows:
  • You write a class extending org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator and override its getBuildParticipant method to return an instance of your build-participant class.
  • In plugin.xml, you use the org.eclipse.m2e.core.projectConfigurators extension point to declare your class as a project configurator and to assign a configurator ID to it.
  • In lifecycle-mapping-metadata.xml, you use the configurator ID to associate the configurator to a particular Maven goal.
The m2e Eclipse plugin registers its class org.eclipse.m2e.core.internal.builder.MavenBuilder at the org.eclipse.m2e.core.internal.builder.MavenBuilder at this extension point, so that MavenBuilder.build() is invoked upon Eclipse resource-change events.
The MavenBuilder.build() method examines the lifecycle mapping to determine which build participants should be invoked, and in which order. It then iterates over these build participants and, for those participants that are “applicable” to the delta of the resource change and the kind of build (full or incremental), invokes the build method of the build participant. (All participants are applicable to a full build. A participant is applicable to an incremental build if the resource delta is non-null or the participant’s callOnEmptyDelta() method returns true.)

That's just the tip of the iceberg, but perhaps it can get you started. 

--
Norman Cohen
Cloud Platform developer tools
Google NYC


_______________________________________________
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




--
Norman Cohen
Cloud Platform developer tools
Google NYC
nhcohen@xxxxxxxxxx
Google Voice: (253) 642-6436 (253-NHCOHEN)

Back to the top