Archive for April, 2008

Create an Eclipse Project by Maven

Monday, April 28th, 2008

You will install this 2 plugin: eclipse plugin for maven and m2eclipse( Maven 2 Eclipse plugin ).

First, you create a Maven project layout:

mvn archetype:create -DgroupId=com.langcode \
                     -DartifactId=Test

This will create a folder named Test ( artifactId, which is your release jar file base name).

After that, we will create the Eclipse project file:

cd Test

mvn eclipse:eclipse

Now, we can start the Eclipse and import the project we created. And do the following steps:

  1. Right click on the project and enable Maven Package management.
  2. Update Maven dependency.
  3. Update Maven Source folder.

Now, you have an Eclipse development set up. You will want to add some common maven phase into Run menu using the “Run As” Dialog. Or, you can do it manually in CLI.

Some common tasks are:

Clean up:

mvn clean

Build Jar:

mvn package

Copy all dependencies into target folder:

mvn dependency:copy-dependencies

Run Test:

mvn test
  • Share/Bookmark

Maven

Monday, April 28th, 2008

These few days, I have special interests on maven. A java ( well, I am not sure if it is Java only) building tool.

The reason I am looking for a building tool is we are currently changing our development tool chain from NetBeans to Eclipse ( Some Windows nuts insist on JBuilder, which is based on Eclipse as well ). The problem is we have to do a lot to convert the projects to eclipse ones and have them built under eclipse. So, we want to find an IDE neutral build environment.

what is Maven?

Maven, a Yiddish word meaning accumulator of knowledge , was originally started as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects each with their own Ant build files that were all slightly different and JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects.

The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

Maven’s Objectives

Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features
  • Share/Bookmark