If Eclipse is automatically generating classes in target/classes from your
classes in src/test/java, I think there is a problem, since src/test/java
classes should end up in target/test-classes. I would recommend

(1) running eclipse:eclipse on your project (to update your Eclipse
.classpath) and then
(2) perform a clean (to clean out the old files in target/classes).

As an example, if I execute 'mvn eclipse:eclipse' on a web project of mine,
my Eclipse project .classpath file ends up with the following:
...
  <classpathentry kind="src" path="src/main/java"/>
  <classpathentry kind="src" path="src/test/java"
output="target/test-classes"/>
  <classpathentry kind="output" path="target/classes"/>
...

Notice that src/test/java classes go to target/test-classes.

After performing eclipse:eclipse and refreshing your project, your
.classpath should be similar to the above.

After this, you should perform a 'mvn clean' and refresh your project. You
should end up with
 target/classes (empty folder)
 target/test-classes (empty folder)

Now, if you perform a 'mvn clean package', you should see that your regular
classes end up in target/classes and your test classes end up in
target/test-classes. If you inspect your war file that is created, you
should see that it does not contain your test classes.

By the way, it's a good idea to run clean before running lifecycle commands
like 'package' since this ensures that old stuff is cleaned out when you
build your new artifact.

Deron Eriksson

Reply via email to