Kat
Kat

Reputation: 4695

Eclipse with m2e not building tests

I have an Eclipse project that uses Maven. The regular source files (ie, in src/main) build fine in both Eclipse and Maven. However, the test files (ie, in src/test) will only build in Maven. I cannot find any way to get them to build in Eclipse.

That is, the tests in Eclipse are run as the last version which Maven compiled. Before I used Maven, tests would be compiled automatically when they were run in Eclipse. "Build automatically" in the project menu is still enabled.

This only affects the tests (which are JUnit 4 tests). As mentioned, the regular source files are being built automatically correctly.

Here's the POM file, with irrelevant data pruned: https://gist.github.com/anonymous/10001049

Upvotes: 0

Views: 37

Answers (1)

Paul Hicks
Paul Hicks

Reputation: 13999

Add the src/test directory to your build path. Windows / Preferences / Java / Build Path, or something like that.

Updating the project might also work, since m2e can get out of sync with your pom file quite often.

Upvotes: 1

Related Questions