Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search

M2E-WTP/New and Noteworthy/1.0.0

< M2E-WTP‎ | New and Noteworthy
Revision as of 09:10, 26 June 2013 by (Talk | contribs) (New API for Facet Detection for JAXRS/JSF/JPA)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

New and Noteworthy in m2e-wtp 1.0.0

List of all issues fixed for m2e-wtp 1.0.0 : changelog


m2e-wtp requires an Eclipse JavaEE distribution, and can be installed from :

m2e 1.4 and the Maven Archiver 0.15.0+ feature from Sonatype are required. They will be automatically discovered and installed if necessary.

Restart your workspace after the installation.

Java EE 7 support

m2e-wtp now supports the brand new Java EE 7 Facets introduced in WTP 3.5.0 (Kepler).

  • Dynamic Web Facet 3.1
  • EJB Facet 3.2
  • Enterprise Application (EAR) Facet 7.0 - Please note maven-ear-plugin 2.8 doesn't support <version>7</version> yet
  • Application Client Facet 7.0
  • JCA (Connector) Facet 1.7
  • JAX-RS 2.0
  • JPA 2.1
  • JSF 2.2

Also, when m2e-wtp is unable to determine the correct Facet from the maven plugin settings or deployment descriptors are missing, instead of setting a default version, the existing user-installed Facet will be kept.

Be aware the Java EE 7 specs require projects to build using Java 1.7. Don't forget to set the proper maven-compiler-plugin configuration :

  <source>1.7< /source>

Enable/Disable the JAX-RS/JPA/JSF Configurators at the pom.xml level

The optional JAX-RS, JPA and JSF configurators can be enabled or disabled at a workspace level from Window > Preferences > Maven > Java EE Integration. Now, you can have a finer grain control on these configurators directly from your pom.xml properties :

  • Adding <m2e.jaxrs.activation>false</m2e.jaxrs.activation> in your pom properties section will disable the JAX-RS configurator
  • Adding <m2e.jpa.activation>false</m2e.jpa.activation> in your pom properties section will disable the JPA configurator
  • Adding <m2e.jsf.activation>false</m2e.jsf.activation> in your pom properties section will disable the JSF configurator

The pom settings always override the workspace preferences. So if you have, for instance the JPA configurator disabled at the workspace level, using <m2e.jpa.activation>true</m2e.jpa.activation> will enable it on your project anyway.

New API for Facet Detection for JAX-RS/JSF/JPA

A new extension point is available for 3rd party adopters willing to contribute alternative Facet detection strategies for the JPA, JAX-RS and JSF configurators. All you need to do is extend org.eclipse.m2e.wtp.facets.AbstractFacetDetector

public class MyCustomFacetDetector extends AbstractFacetDetector {
  public IProjectFacetVersion findFacetVersion(IMavenProjectFacade mavenProjectFacade, Map<?, ?> context, IProgressMonitor monitor) {
    //context is an optional map containing context sensitive data.
    //It currently only contains a JptXmlRresource instance when invoked by the JPA configurator
    //JptXmlResource jpaXmlResource = (JptXmlResource)context.get(JpaProjectConfigurator.PERSISTENCE_XML_KEY);
    IProjectFacetVersion version = ...//implement Facet detection logic, ex. inspect mavenProjectFacade.getMavenProject().getArtifacts() 
                                      //for interesting   dependencies.
    return version;

In order to contribute the new strategy for the facet of your choice, you need to declare the extension point in your plugin.xml like :

         priority="10"><!-- lowest values have highest priority-->

So if you want to contribute a JPA Facet detector that's invoked *before* the m2e-wtp's built-in PersistenceXmlJpaFacetDetector, give the priority a value lower than 10.

Project conversion enhancements

When converting an Eclipse project to Maven, m2e-wtp will now try to detect the latest available released plugin version from available Nexus Indexes (though that detection strategy may change in the future). If no Nexus index is available or no recent plugin version can be found, then m2e-wtp will fall back on a reference version.

This is particularly useful in the case of the maven-ear-plugin (v2.8), which currently doesn't support Java EE 7. Once a newer version is released, m2e-wtp will be able to use that to perform valid EAR 7 project conversions to Maven.

Disabled validation of build output folder

m2e-wtp now disables WTP validation on the build output folder (usually the target/ folder). This dramatically improves build times when using big war overlays, for instance. Validating resources under that folder makes no sense since they are generally not manually generated and will likely be regenerated automatically on subsequent builds.

Eliminated unnecessary file copies

Prior to WTP 3.5.0, in order to deploy classpath entries under a non default name, m2e-wtp used to copy original files under the target folder, using the deployed name, then make the Maven Classpath library point at the copied file. This non-pretty workaround could cause bad file locking issues under Windows.

Since WTP 3.5.0 (Kepler), that file copy is not necessary anymore. WTP is now able to directly deploy classpath entries under non-default names. The old file copy-based workaround is still used when m2e-wtp is used with older WTP versions.

Back to the top