You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Enrique Rodriguez <en...@gmail.com> on 2007/09/30 00:12:53 UTC

Testing issue, need pointers

Hi, Directory developers,

I'm looking for pointers for an issue I recall coming up before,
namely that reusable test classes that are in "src/test/java" don't
get packaged into artifact jars, so they can't be reused by other
Maven2 modules.  When I asked before someone (David?) had a best
practice here and I don't recall enough to find the answer or thread.

There are base classes in server-unit and in local work I have for
Kerberos that are only used by tests but that would be nice to reuse.
Of course, the simple solution is to move these classes to
"src/main/java," but that was shutdown before in favor of this other
solution I'm alluding to.

TIA,

Enrique

Re: Testing issue, need pointers

Posted by David Jencks <da...@yahoo.com>.
On Sep 29, 2007, at 3:12 PM, Enrique Rodriguez wrote:

> Hi, Directory developers,
>
> I'm looking for pointers for an issue I recall coming up before,
> namely that reusable test classes that are in "src/test/java" don't
> get packaged into artifact jars, so they can't be reused by other
> Maven2 modules.  When I asked before someone (David?) had a best
> practice here and I don't recall enough to find the answer or thread.
>
> There are base classes in server-unit and in local work I have for
> Kerberos that are only used by tests but that would be nice to reuse.
> Of course, the simple solution is to move these classes to
> "src/main/java," but that was shutdown before in favor of this other
> solution I'm alluding to.
>

So what you need to do is to get maven to package up jars with the  
"tests" classifier for these modules, containing the tests.  Then  
other subprojects can depend on the test jars.

If you configure the jar plugin to do this for everything in the  
project it would be in pluginManagement like:

                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-jar-plugin</artifactId>
                     <version>2.1</version>
                     <executions>
                         <execution>
                             <goals>
                                 <!-- Build *test.jar files for  
modules -->
                                 <goal>test-jar</goal>
                             </goals>
                         </execution>
                     </executions>
                 </plugin>

this might be overkill for the whole project, but I think you can  
just include something like this without the version in the  
<build><plugins> section of an individual subproject.

To use one of these test jars your dependency would look something like

         <dependency>
             <groupId>org.apache.geronimo.components</groupId>
             <artifactId>geronimo-connector</artifactId>
             <classifier>tests</classifier>
         </dependency>

thanks
david jencks



> TIA,
>
> Enrique