You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gul Onural <go...@rim.com> on 2009/06/18 17:19:56 UTC

how to specify dependencies between test classes

Hi,

In the project I am working on, there is a need to specify dependencies
between the test source directories.

The project tree looks like similar to this :

- componentA
   - src
      - main
      - test
- aCommonComponent	
   - src
      - main
      - test

In the JUNIT test cases defined under componentA/test, I want to be able
to use a Java class defined under aCommonComponent/test.
Defining a dependency to aCommonComponent inside componentA's pom file
doesn't help because the class I want to use is under test directory
of the aCommonComponent.

What is the proper way of doing this in maven2 ? 

Thanks,

Gul

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

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


Re: how to specify dependencies between test classes

Posted by Tony Chemit <ch...@codelutin.com>.
Le Thu, 18 Jun 2009 11:19:56 -0400,
"Gul Onural" <go...@rim.com> a écrit :

> 
> Hi,
> 
> In the project I am working on, there is a need to specify
> dependencies between the test source directories.
> 
> The project tree looks like similar to this :
> 
> - componentA
>    - src
>       - main
>       - test
> - aCommonComponent	
>    - src
>       - main
>       - test
> 
> In the JUNIT test cases defined under componentA/test, I want to be
> able to use a Java class defined under aCommonComponent/test.
> Defining a dependency to aCommonComponent inside componentA's pom file
> doesn't help because the class I want to use is under test directory
> of the aCommonComponent.
> 
> What is the proper way of doing this in maven2 ? 
> 
> Thanks,
> 
> Gul
> 
You can expose your aCommonComponent in the classifier test

<build>
<plugins>
<plugin>
     <artifactId>maven-jar-plugin</artifactId>
     <executions>
           <execution>
              <id>attach-test</id>
              <goals>
                 <goal>test-jar</goal>
              </goals>
      </execution>
    </executions>
 </plugin>
</plugins>
</build>

and use it in your componentA

<dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>aCommonComponent</artifactId>
                <version>${project.version}</version>
                <scope>test</scope>
                <classifier>tests</classifier>
            </dependency>

This should works :)

Best regards,

tony.

> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain
> confidential information, privileged material (including material
> protected by the solicitor-client or other applicable privileges), or
> constitute non-public information. Any use of this information by
> anyone other than the intended recipient is prohibited. If you have
> received this transmission in error, please immediately reply to the
> sender and delete this information from your system. Use,
> dissemination, distribution, or reproduction of this transmission by
> unintended recipients is not authorized and may be unlawful.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 



-- 

Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: chemit@codelutin.com  
http://www.codelutin.com 

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


RE: how to specify dependencies between test classes

Posted by Damon Silver <da...@diio.net>.
Specify a test-jar goal in the <build> section of aCommonComponent's pom
(see documentation for maven-jar-plugin), invoke mvn jar:test-jar on that
project, then try this in the componentA pom:

    <dependency>
      <groupId>foo.bar</groupId>
      <artifactId>aCommonComponent</artifactId>
      <version>1.0</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

- Damon

-----Original Message-----
From: Gul Onural [mailto:gonural@rim.com] 
Sent: Thursday, June 18, 2009 8:20 AM
To: users@maven.apache.org
Subject: how to specify dependencies between test classes


Hi,

In the project I am working on, there is a need to specify dependencies
between the test source directories.

The project tree looks like similar to this :

- componentA
   - src
      - main
      - test
- aCommonComponent	
   - src
      - main
      - test

In the JUNIT test cases defined under componentA/test, I want to be able
to use a Java class defined under aCommonComponent/test.
Defining a dependency to aCommonComponent inside componentA's pom file
doesn't help because the class I want to use is under test directory
of the aCommonComponent.

What is the proper way of doing this in maven2 ? 

Thanks,

Gul

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential
information, privileged material (including material protected by the
solicitor-client or other applicable privileges), or constitute non-public
information. Any use of this information by anyone other than the intended
recipient is prohibited. If you have received this transmission in error,
please immediately reply to the sender and delete this information from your
system. Use, dissemination, distribution, or reproduction of this
transmission by unintended recipients is not authorized and may be unlawful.

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




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