Hi, I posted this on 
http://stackoverflow.com/questions/5075509/how-do-i-use-mvn-test-with-multiple-modules
stackoverflow  but no one is responding, so I'm trying here.

My problem is that I am unable to run mvn test normally when one module
depends on test classes in another module.

Strangely enough things seem to work if I run mvn package test. That's weird
and I'd rather not have to do it and I'm wondering if it just means I'm
doing something wrong. Here's the gory details:

 ...
 <!-- module A -->
 <parent>
   <groupId>com.acme.parent</groupId>
   <artifactId>parent</artifactId>
   <relativePath>../pom.xml</relativePath>
   <version>1.0</version>
 </parent>
 <groupId>com.acme</groupId>
 <artifactId>A</artifactId>     
 <packaging>jar</packaging>
 <version>1.0</version>
 <build>
   <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-jar-plugin</artifactId>
       <executions>
        <execution>
          <goals>
            <goal>test-jar</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
...

...
<!-- Project AB (depends on A) -->
<parent>
  <groupId>com.acme.parent</groupId>
  <artifactId>parent</artifactId>
  <relativePath>../pom.xml</relativePath>
  <version>1.0</version>
</parent>
<artifactId>AB</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<dependency>
  <groupId>com.acme</groupId>
  <artifactId>A</artifact>
  <version>1.0</version>
</dependency>
<dependency>
  <groupId>com.acme</groupId>
  <artifactId>A</artifact>
  <version>1.0</version>
  <type>test-jar</type>
  <scope>test</scope>
</dependency>
...

...
<!-- And finally, the relevant bits from the parent pom -->
<groupId>com.acme.parent</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
  <module>A</module>
  <module>AB</module>
</module>
...

So, with all that said, how do I make mvn tests run as expected with mvn
test?

I'm using maven 2.2.1.
-- 
View this message in context: 
http://maven.40175.n5.nabble.com/mvn-test-with-multiple-modules-tp3396572p3396572.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to