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

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.

Comments (0) 5:12 pm

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .