MyEclipse Logo
 

Using Maven in MyEclipse Overview (Maven4MyEclipse)

Outline

download the latest MyEclipse version

help and support
 

1. Introduction

This overview will introduce you to the basic concept of what Maven is, and how working with Maven in MyEclipse (Maven4MyEclipse) improves the Maven experience within the UI.

Maven4MyEclipse is equally useful for the novice and Maven guru alike, because it makes the most oft-used Maven tasks easy.

The Maven guru may find that some of the Maven4MyEclipse documentation is focused more towards the novice. We have made it quick to scan through the parts that you would already know.

Maven4MyEcliipse is a long term committment for MyEclipse - we will be rolling out new features as we learn more about how our customers enjoy using it. We would encourage you to send us feedback and letting us know where the Maven tooling falls short in any area, so we can enhance it for you.


 

2. What is Maven?

In the simplest sense, Maven is a project management tool whose core reputation is based around it's project-building capabilities. Many regard Maven as only a build tool, but its plugin-based nature (not unlike Eclipse) allows it to function as an end to end project management tool, providing a theoretically limitless array of features. The variable nature of these plugins leads to some of the confusion around "What is Maven?" question.

The core design of Maven is built upon dependency management and a single jar repository. Your project's library requriements are defined along with other build requirements. Maven follows a strict standard of jar versioning, the typical " myproject.jar" convention doesn't pass muster, not in the Maven world. It has to be myproject-1.3.7.jar, or at worst myproject-SNAPSHOT.jar. Maven updates those libraries from referenced (public or private) repositories, and each is pulled into your local Maven repostitory as builds are executed. Strict rules are followed as to which local jars are updated and when, and management can declare these rules as part of the project's metadata. (pom.xml).

Maven projects are defined by Convention Over Configuration. In other words, you don't define anything in a Maven pom.xml (project definition file) except what is different from or additional to a standard Maven project. Thus, every project runs the same core phases  which include the many goals   included therein. Even additional custom plugins are typically laced into these same phases when a Maven goal is run.

This maven.apache.org document explains the simple nature of the Maven Lifecycle.

If you are Ant user, this is perhaps the hardest part of Maven to grasp - the idea that you don't, rather than do, write the core build script. If you've done the inverse for 5 years like most corporate developers, this can be a puzzling. Especially since - like Ant - you can still customize a Maven build until the cows come home. You just don't start out that way. You can even customise it easily, with calls straight into Ant....


3. What is Maven4MyEclipse?

Maven4MyEclipse is an enhanced integration between Maven (See Section 2) and MyEclipse IDE. This integration removes some of the most common barriers to entry for Maven users, including:

  • Background installation of Sun jars from our classpath containers into your local Maven repository
  • Easy configuration of JDK for runtime and compile time Maven
  • Easy installation of your own jars into Maven repository

By removing these barriers to entry, you can simply use Maven in MyEclipse with a project and off you go; no additional headaches or setup to contend with.

The MyEclipse team approached Maven in this fashion after discussing the use of Maven for years with our customers (both large and small). We saw opportunities to make the use of Maven much easier than it currently was for a lot of them, and allow new users to get the benefits of Maven if they wanted to use it for their own projects without needing to confer with a Maven guru or pour through docs.

We hope you find the Maven integration in MyEclipse powerful and accessible. Please send us any feedback you have while using the tooling; it will give us an opportunity to grow and expand it as necessary in upcoming releases.

Maven4MyEclipse uses two primary approaches to making common Maven tasks easier

  1. Using wizards to define data easily in the pom.xml, or Maven project metadata.
  2. Providing both standard and easily customizable menus for launching the Maven goals you use every day.

4. Using Maven with MyEclipse Projects

Maven4MyEclipse creates projects that conform to legacy MyEclipse project structures on the source code side. This allows you to code your projects in the same way that you have always done with MyEclipse projects. The classpath containers and compiled binaries are all structured to Maven conventions, so you have the best of both worlds for MyEclipse users moving to Maven for the first time.

NOTE: Maven is only supported for new projects. Migration of existing projects to Maven-enabled projects is not supported at this time, but may be considered for a later release. Right now the MyEclipse team is focused on providing as fluid a new-Maven-project experience as possible.


4.1 Projects that Support Maven

Maven4MyEclipse brings Maven support to MyEclipse Web Projects, MyEclipse EJB Projects, and conventional Java projects.

NOTE: MyEclipse Enterprise Application (EAR) Projects are not supported at this time, but should be in a future release.

Maven4MyEclipse creates your Maven-enabled MyEclipse projects to work with both Maven and MyEclipse tooling simultaneously. Maven-enabled MyEclipse projects function normally as MyEclipse projects, offering all the same tooling that any typical MyEclipse project provides: views, editors, deployment and debugging. None of the tools you have come to rely on have changed. The difference is in the additional tools available to you.

Maven-enabled MyEclipse projects will function like MyEclipse projects as well as Maven projects; allowing you to run any Maven goal against them using the MyEclipse IDE, manage dependencies and more.


5. Maven4MyEclipse Compatability with Command-Line Maven

Maven4MyEclipse and Maven-enabled MyEclipse projects co-exists with command line Maven use perfectly.

NOTE: As is the case with any externally-generated artifacts, we always recommend refreshing your project after an external process like Maven or Ant runs.

Maven4MyEclipse was designed, however, to make command line Maven un-necessary in most instances, allowing you to stay inside the IDE and execute all Maven tasks from the UI.


6. Maven Cautionary Reminder

The MyEclipse team views the addition of the Maven tool-set an important step in making the lives of enterprise developers easier, and more effective. This might seem curious, given Maven's sometimes well earned reputation for frustrating it's users at times. As stated in number 1 above, we have removed many of the obstacles that normally plague the Maven user in his/her first few hours.

  • Easing the first Maven jar installs as in number 1 above.
  • Making sure your project works perfectly with MyEclipse tooling without ever even calling a single Maven goal.
  • Providing reference and tips for most well known challenges for the Maven initiate.

As a developer, however, you are strongly encouraged to treat the raw power of Maven as you would any new and complex technology. More specifically, Maven can come with some rough edges at times, so budgeting time to deal with these appropriately might be a good idea if you are intending to roll out Maven beyond your workspace, to the enterprise level.

Maven's rough edges are not unwarranted, it is an ever more powerful tool set, and these challenges come with the territory. Some can be dealt with by adding one of several repository tools at the server level, other challenges are addressed as a simpler change of habits or even culture. The many plugins availlable are also at various stages of maturity, and any single plugin can affect the entire build lifecyle negatively, such as when a plugin is missing from a public repository.

Our interest in furthering helping you make Maven and MyEclipse work better together will continue in future releases. Please let us know how you like the Maven tooling, where it shines and where it might need improvement as you use it. As we covered, Maven is a complex technology stack that can introduce complexities or issues into your environment if not researched correctly. Our goal is to make it as powerful a device for your enterprise development as possible while minimizing the risks.


7. FAQ

Below is a list of frequently asked questions about Maven4MyEclipse and how Maven development inside of MyEclipse works.

  • What is Maven?
  • What is Maven4MyEclipse? How does it relate to Maven?
  • Do I have to be familiar with Maven to use Maven4MyEclipse?
    • No, but we would recommend reading Section 2 just to become familiar with what Maven is so you can make sense of the Maven-functionality in Maven4MyEclipse.

8. User Feedback

If you have comments or suggestions regarding this document please submit them to the MyEclipse Documentation Forum.