0

I have 2 modules mod1 and mod2 from a same parent project. mod2 depends on mod1 and mod2 pom.xml includes the following dependancy

<dependency>
    <groupId>com.project</groupId>
    <artifactId>mod1</artifactId>
    <version>${project.version}</version>
</dependency>

in mod1, I have defined in src/test/java an abstract test class

public abstract class ServicesAbstractTest {
...
}

in mod2, src/test/java I have defined a test class which inherits this one.

public class Mod2Test extends ServicesAbstractTest {
...
}

These are all Junit 4 tests. It works fine when I run the tests in Eclipse directly. But doesn't work when I do a mvn clean install, there are compilation errors showing that maven doesnt find ServicesAbstractTest when compiling and testing mod2.

I tried to apply what is said on similar questions : Pascal Thivent answer and Duncan Answer with 2 additional problems :

Strange

Could not find goal 'test-jar' in plugin org.apache.maven.plugins:maven-surefire-plugin:2.2 among available goals test -> [Help 1]

And more compilation problems for module 2 : I think I need here to specify additionnal scope, not only test, I am going to do further research on this one.

Community
  • 1
  • 1
Yves Nicolas
  • 6,901
  • 7
  • 25
  • 40
  • The error message you're getting makes it sound like you tried to add the 'test-jar' goal to the configuration of the surefire plugin instead of the maven-jar-plugin which actually has that goal. – 1337joe May 16 '15 at 06:56
  • definitely it, thanks 1337joe – Yves Nicolas May 16 '15 at 08:00

1 Answers1

0

1337joe 's comment is the one. Pascal Thivent's answer is what I was looking at.

Lessons learned

  1. When finding a problem, begin to ask the question as precisely as possible. This is the best way to be pointed toward the most relevant answers to your problem. You might think you are loosing time in writing your question compare to a single google search with code error. You are actually finding faster the right answers

  2. Dont be ashamed to look foolish when it happens that you just did a typo or equivalent : a second eye is always the best. It took probably 20 seconds to 1337joe to point out my plugin confusion that I could have spent hours on being too deeply involved in the problem.

Community
  • 1
  • 1
Yves Nicolas
  • 6,901
  • 7
  • 25
  • 40