Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "M2E-WTP/New and Noteworthy/1.0.0"

(Pre-Requisites)
(New API for Facet Detection for JAXRS/JSF/JPA)
Line 46: Line 46:
  
 
=== New API for Facet Detection for JAXRS/JSF/JPA ===
 
=== New API for Facet Detection for JAXRS/JSF/JPA ===
TODO
+
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, implement org.eclipse.m2e.wtp.facets.AbstractFacetDetector
 +
 
 +
<source lang="java">
 +
public class MyCustomFacetDetector extends AbstractFacetDetector {
 +
  @Override
 +
  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;
 +
  }
 +
}
 +
</source>
 +
 
 +
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 :
 +
<source lang="xml">
 +
    <extension
 +
          point="org.eclipse.m2e.wtp.facetDetectors">
 +
      <facetDetector
 +
            class="org.eclipse.m2e.wtp.jpa.internal.configurators.PersistenceXmlJpaFacetDetector"
 +
            facetId="jpt.jpa"
 +
            priority="10"><!-- lowest values have highest priority-->
 +
      </facetDetector>
 +
    </extension>
 +
</source>
 +
 
 +
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  ===
 
=== Project conversion enhancements  ===

Revision as of 05:14, 13 May 2013

New and Noteworthy in m2e-wtp 1.0.0

List of all bug fixed for the current Milestone : changelog

Pre-Requisites

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

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 :

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.1</version>
  <configuration>
  <source>1.7< /source>
  <target>1.7</target>
  </configuration>
</plugin>


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 JAXRS/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, implement org.eclipse.m2e.wtp.facets.AbstractFacetDetector

public class MyCustomFacetDetector extends AbstractFacetDetector {
  @Override
  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 :

    <extension
          point="org.eclipse.m2e.wtp.facetDetectors">
       <facetDetector
             class="org.eclipse.m2e.wtp.jpa.internal.configurators.PersistenceXmlJpaFacetDetector"
             facetId="jpt.jpa"
             priority="10"><!-- lowest values have highest priority-->
       </facetDetector>
    </extension>

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

TODO Conversion use latest maven plugin versions

Disabled validation of build output folder

TODO

Eliminated unnecessary file copies

TODO

Back to the top