Sunday, February 15, 2009

What's Maven


These days I learnt a lot on Maven and Java, especially how to use it. I need to record them one by one so as not to forget them soon.

First of all, what's Maven. (Maven in five minutes.)

The most useful two commands:
1.
project_path>mvn clean package, to rebuild
2. project_path>mvn clean package exec:java, to clean, rebuild and run it.

Import Maven add-on to MyEclipse. Since the Together and the JBuilder I used before didn't support this add-on, M2Eclipse, because of their old version, I have to change the work tool to MyEclipse.

Step 1.
Afte
r installation of MyEclipse, click Help, then Software Updates, then Find and install, then Search for new features to install. It will open a new window.

New Remote Site... Then Type M2Eclipse in the name area and copy this line: http://m2eclipse.sonatype.org/update/ to URL. Then finish.Select the options of the M2Eclipse tree which would not fail the update(there are three not to enable)
Step 2.
Winkey + R open
the cmd window. Go to the project folder, here is D:\project\netcomp. Execute this command of mvn:
mvn eclipse:eclipse


Step 3:
Go to Eclipse, import the two projects, kegg and netcomp.

Step 4.
Right click the projects one bye one. There is a maven menu, choose "Enable Dependency Management". Now the projects are managed by Maven dependently.








4 comments:

Todd said...

You didn't mention what version of MyEclipse you're using so I just want to point out that MyEclipse 7.0 already ships with full Maven support called maven4myeclipse, which is an enhanced version of m2eclipse. So, while the steps here are necessary with MyEclipse 6.6 and prior, for MyEclipse 7 and later you don't need to install anything additional to get the Maven support you're looking for. It's all built in, integrated, and works great. More information on the MyEclipse website here: http://myeclipseide.com/module-htmlpages-display-pid-392.html

Eugene Kuleshov said...

Steps 2 and 3 are unnecessary, you can just use "File / Import... / Maven Projects" wizard.

Tingting said...

To Todd:
Oh yes, MyEclipse7 is What I am using now is MyEclipse 6.0, so I have to add this add-on by hand. MyEclipse7 is better but I haven't it now. Maybe try it later. Thank you for telling me that.

To Eugene:
Right, this way seems to be a short cut. Thanks.

Tingting said...

But for the nested Maven projects, "File/Import .../Maven Projects" may have problems.