Yes the helper classes (in src/test/java) needs to be packaged and 
installed to the repository so that another maven project can reference. 
By default, maven-jar-plugin doesn't jar up class in src/test/java. By 
default, all of the classes in src/test/java as well as src/test/resources 
will be included in the jar. I don't see why it would matter if your unit 
tests are jarred up as well.

The scope element tells that the dependencies are only for testing phase. 
The type element tells it to look for test jar of the helper artifact 
(rather than the helper jar itself).

When you are ready to run the project, go to your root pom and do a clean 
install (this will make sure that your test jar is deployed to your local 
repository)

Cheers,
rOnn c.







jsweeney67 <[EMAIL PROTECTED]> 
11/15/2007 12:55 PM
Please respond to
"Maven Users List" <users@maven.apache.org>


To
users@maven.apache.org
cc

Subject
Re: JUnit and Maven - compiling helper classes







So, if I understand correctly, the helper classes need to be in a jar. 
These
classes now live in the same packages as the JUnit tests so should the jar
exclude the actual test classes?

I then presume that the "scope" tag tells Maven to only look for the new 
jar
if tests are being run, correct?

Thanks!  I appreciate the response.


Ronn.Chinowutthichai wrote:
> 
> You need to create a test-jar artifact out of your helper classes
> 
> Put this in the pom of your helper classes
> 
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-jar-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>test-jar</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
> 
> This will create a test-jar.
> 
> Then in the project that you depend on these helper classes in test 
> packages, declare a dependency to it with a type tag.
> 
> i.e.,
>         <dependency>
>             <groupId>your group id</groupId>
>             <artifactId>helper project</artifactId>
>             <version>version</version>
>             <type>test-jar</type>
>             <scope>test</scope>
>         </dependency>
> 
> Cheers,
> rOnn c.
> 

-- 
View this message in context: 
http://www.nabble.com/JUnit-and-Maven---compiling-helper-classes-tf4808900s177.html#a13760218

Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



######################################################################
DISCLAIMER:
This email and any attachment may contain confidential information.
If you are not the intended recipient you are not authorized to copy
or disclose all or any part of it without the prior written consent
of Toyota.

Opinions expressed in this email and any attachments are those of the
sender and not necessarily the opinions of Toyota.
Please scan this email and any attachment(s) for viruses.
Toyota does not accept any responsibility for problems caused by
viruses, whether it is Toyota's fault or not.
######################################################################

Reply via email to