Thanks! I found out it based on your comments. Followings is the details I
have done.
1. Add <build> snippet into pom.xml of project B. After the execution of
mvn:install, then .../src/main/java/ and /src/test/java were packaged
respectively and installed on my local repository.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
<project>
<...>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<...>
</project>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
2. Add this dependency into project A.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
<!--The test myapp-hut-->
<dependency>
<groupId>com.mycompany.hut</groupId>
<artifactId>myapp-hut</artifactId>
<version>1.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
3. Then mvn test, things go smoothly.
Thank again.
2008/12/12 Wayne Fay <[email protected]>
> > Simply, we can resolve it by adding test classes into jar (default
> > packaging). Somebody could tell me how? Or any other suggestions would be
> > appriciated.
>
> You want to create and use a test-jar artifact. This is documented on
> the Maven site and in various other places, eg:
> http://stackoverflow.com/questions/174560/sharing-test-code-in-maven
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>