Working with Maven in Eclipse

Fred Bricon / @fbricon

Eclipse Day Beijing 2013

Fred Bricon is ...

  • Developer at Red Hat JBoss
  • Working on JBoss Tools and Developer Studio
  • Committer on m2e
  • Project Lead of m2e-wtp

About m2e

m2e is the official Maven Integration for Eclipse plugin

  • integrates Apache Maven to Eclipse's incremental build
  • provides tight JDT integration
  • is a Platform/Framework for others to build upon

m2e features

  • Wizards for importing or creating projects
  • Provides a powerful POM editor
  • Launch configurations (to run maven)
  • Automatic download of java sources
  • Access Maven repository indexes

Challenges

  • Eclipse Platform/IDE has oustanding limitations

    • single compilation classpath(test==main)
    • no nested project support
  • Maven plugins are not -always- fit for incremental builds.

    • sometimes execution is irrelevant
    • poor performance in IDE
    • can cause resource leaks, infinite build loops

Lifecycle Mapping

m2e looks for interesting Maven build phases

what plugins can be executed?

During an incremental build, maven plugin execution can be :

  • ignored
  • executed
  • delegated to an m2e connector

Lifecycle Mapping - cont'd

Lifecycle Mappings can be stored :

  • inside pom.xml
  • at the workspace level
  • inside Eclipse (m2e) plugins
  • inside Maven plugins

About m2e-wtp

aven Integration for Eclipse WTP

  • m2e sub-project, graduated from incubator
  • provides a bridge between Maven (m2e) and Eclipse WTP
  • now included in the Java EE Kepler distribution

m2e-wtp features

  • Provides Java EE (->7) project facet integration
  • Dynamic War Overlay support
  • Dynamic Web Resource filtering support
  • Eclipse to Maven project conversion
  • Optional JAX-RS, JSF, JPA configurators

Demo time

Let's create our own continuous integration server!

m2e ecosystem

  • m2e-tycho
    • Build Eclipse plugins / OSGi
  • JBoss Tools / JBoss Developer Studio
    • CDI, Hibernate, Portlet, GWT configurators
    • Maven Profile Management UI
    • Jar -> Dependency conversion
  • SpringSource/Grails Tools Suite
    • Groovy support
  • and m2e-wro4j, m2e-scala and more...

Any questions?

Links