How do I add unit tests to a module with Eclipse?

Dear all,

I am working on the and want to add unit tests.

I am using eclipse (with egit and maven integration plugin).

I cloned the github repo, then in eclipse imported the “git repo locally” and then imported “existing maven projects” and selected the the local path of the repo.

The radiologydcm4chee module misses unit tests in its api, so I added the folders with fictive test file




Tests and build runs fine from the command line with ‘mvn clean package’ but eclipse keeps telling me

“Source folder is not a Java project.”

It wont auto-format those files and keeps showing me these question marks on the folders and files in that new test directory.

Do I have to include this new test directory in the api’s pom file? Did I import of the module the wrong way in eclipse?

I appreciate your help to my newbie question! Thank you very much! Ivo

lessons learned:

  • use Eclipse IDE for Java EE Developers (has all the nice plugins already installed)
  • git clone the repository you want to work on
  • import your local git repository as “Existing Maven Projects”

At first I did

  • Run As --> “Maven install”

and whenever I changed the structure (added folders and pom’s settings to include those new resources, tests) I ran

  • Maven --> “Update Project”

No question marks, no problems :smile: