Ahti Kitsik
Building develper tools. Python, Java, JavaScript.

writings about @ahtik

Maven 2, Java 5, JUnit 4 and Eclipse with 3 steps!

By Ahti Kitsik, 19 Oct 2006

STEP 1 - Create project
mvn archetype:create -DgroupId=com.timegt.core -DartifactId=timegt-core

STEP 2 - Fix pom.xml
1. replace name and url
2. replace 3.8.1 with 4.1 for junit-4.1 support
3. add this for JDK 5.0 support:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>

STEP 3 - Generate eclipse project settings and download/link sources
mvn eclipse:eclipse -DdownloadSource
Voila! Ready to go :)

Open Eclipse and Import existing project into workspace.

Project structure, sample class and sample junit test is now created and eclipse is ready to rock!

After that you can do
mvn compile
mvn test
mvn package
mvn install
mvn clean
or whatever makes you happy.

Repeat "mvn eclipse:eclipse" whenever you change maven dependencies.

@ahtik is on twitter!