Thursday, October 4, 2007

Maven for Eclipse

About maven on my blog

Install maven
Download direct link (tar.gz ver. 2.0.7)
Unpack it by:
tar xzfv maven-2.0.7-bin.tar.gz


Configure Maven
In your home directory within .profile file add lines with changes according your path:
export MAVEN_HOME=/home/alexey/java/maven2
export PATH=$MAVEN_HOME/bin:$PATH


Configure Eclipse
Window -> Preferences ->
Java -> Build Path -> Classpath Variables
Set new:
Name "M2_REPO"
Path "/home/alexey/java/maven2/repository"

Run maven on Eclipse
Run -> Open Run Dialog ... ->
Double Click on "Java Application"
1. Main
Enter Name, choose project for build, insert main class "org.codehaus.classworlds.Launcher"

2. Arguments
Program arguments: "clean install"
VM arguments, modify with your situation:
-Xmx300m
-cp "/home/alexey/java/maven2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"
-Dclassworlds.conf="/home/alexey/java/maven2/bin/m2.conf"
-Dmaven.home="/home/alexey/java/maven2"
-Dtest.repository=db1

3. Classpath
Add to the "User entries" classworlds-1.1-alpha-2.jar by click "Add External JARs ..."
e.g.: from repository/classworlds/1.1-alpha-2/
Have you seen this error?
========================
[INFO] [antrun:run {execution: 1}]
[INFO] Executing tasks
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: taskdef A class needed by class xdoclet.modules.hibernate.HibernateDocletTask cannot be found: org/apache/tools/ant/DynamicConfigurator
========================

Than add to "Bootstrap Entries" the ant jar "ant-_._._.jar"
e.g.: from repository/ant/ant/1.6.5/ant-1.6.5.jar

Apply and Run

No comments: