How to set up a new Eclipse project in net.fnarg package

[sourcecode language=”bash”]
mvn -o archetype:generate -DartifactId=classes-objects -DgroupId=net.fnarg.javatut
[/sourcecode]

I accepted the archetype defaults offered by generate

[sourcecode language=”bash”]
cd classes-objects/
mvn -o eclipse:clean eclipse:eclipse
[/sourcecode]

Eclipse > New > Java Project
Use default location

Eclipse > Preferences > Java > Build Path > Classpath Variables
New > M2_REPO = $WORKSPACE/mvn/repo

Maven creates this structure.

src/main/java
  net/fnarg/javatut
    class-objects/*.java
src/test/java
  net/fnarg/javatut
    class-objects/*.java

This project has no dependencies other than JUnit.
Update the pom.xml JUnit is version 4.6

Eclipse > File > Import > File system

note in Eclipse on Mac using a minus like ‘this-that’ gives an error in the package name.

Leave a Reply

Your email address will not be published. Required fields are marked *