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.

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


Back to the top