Hi GreJ,
You must do an install in order for the test-jar to be available, otherwise
it won't be installed and can't be referenced as a jar by the dependent
project. You will also need to list the dependency as a normal dependency
and a test jar in order to successfully do a mvn compile and mvn install.
For example, if I have a module called "common" with both code and tests I'm
referencing in the current pom/proejct, I would need to have the following
in my child pom:
<dependency>
<groupId>org.myapp</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency>
<groupId>org.myapp</groupId>
<artifactId>common</artifactId>
<version>${appVersion}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
I've also noticed that while Maven manages transitive dependencies for your
application modules, it is not the case for the test jars, so if you have
multiple test jars you're using, you'll need to list them all, even if they
are also dependencies of a module you've already listed.
This is what I've had to do to get it to work, anyway. I haven't tried the
package command yet in this situation, so I can't speak for what happens
there.
Hope this helps,
Jim
On 3/23/07, GreJ <[EMAIL PROTECTED]> wrote:
Hi,
I have the same problem and followed exactly the maven2 help.
But it seems that Maven2 can't find the test-jar without the install. So
the
dependency ist not resolved.
It works only with an install, and not with the 'package' command.
Is it a bug ?
[Sorry for the bad english, i need more practice ;) ]
Jim Bethancourt wrote:
>
> Yup! That did the trick.
>
> Thanks Jason!
> Jim
>
> On 3/21/07, Jim Bethancourt <[EMAIL PROTECTED]> wrote:
>>
>> Cool! That looks exactly like what I need. I'll give it a go. ;-)
>>
>> Thanks,
>> Jim
>>
>> On 3/21/07, Jason van Zyl < [EMAIL PROTECTED]> wrote:
>> >
>> >
>> > On 21 Mar 07, at 3:17 PM 21 Mar 07, Jim Bethancourt wrote:
>> >
>> > > Hi all,
>> > > I'm working on a multi-pom project and would like to inherit from
>> > > classes in
>> > > the test hierarchy across modules in the project, and I'm listing
>> each
>> > > module as a dependency in the parent pom as well. I've done
several
>> > > experiments to see if this is possible and have had no success.
>> > > What would
>> > > be the appropriate way to enable inheritance of classes in the test
>> > > hierarchy across modules during the test-compile phase of a
multi-pom
>> > > project? Is such a feature available right now for Maven 2, or
>> > > should I
>> > > submit a JIRA request?
>> >
>> > I think this is what you're looking for:
>> >
>> > http://maven.apache.org/guides/mini/guide-attached-tests.html
>> >
>> > >
>> > > Thanks,
>> > > Jim
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>
>
--
View this message in context:
http://www.nabble.com/Unit-Test-inheritance-in-a-multi-pom-project--tf3442738s177.html#a9642658
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]