You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "matthew.hawthorne" <ma...@apache.org> on 2004/06/07 07:26:11 UTC

I wish there were test:jar and test:jar-install goals

I frequently find myself in situations where I need a "test:jar" and 
"test:jar-install" goal.  Sometimes I have set of fairly abstract tests
that the tests in another subproject depend on.  Other times, I have 
tests that need to be run in a certain environment
(inside of a container), and I need to war.bundle the test jar into a war.

Currently, my options for doing this are:

1) Do some maven.xml magic to build a test jar whenever the main jar is 
built, and install the test jar whenever the
main jar is installed.

2) Put the unit tests in a separate project from the classes that they 
are testing, so they will be in the sourceDirectory
instead of the unitTestSourceDirectory, and therefore easy to build and 
install.

But, as I've suggested, I think this would be easier if there were goals 
to build and install test jars.

Anyone else agree?

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


Re: I wish there were test:jar and test:jar-install goals

Posted by "matthew.hawthorne" <ma...@apache.org>.
Carlos Sanchez wrote:
> If you are using test utilities and superclasses in different projects (as I
> do) you should add them to src/java dir as any other utility classes. This
> way they will be packed when calling jar plugin.

True, but I'd want to do it in a different subproject then, and have the 
2 side-by-side, like:

myproject/
	src
myproject-tests/
	src

I don't want my main code and test code in the same source tree, since I
only want the test classes if I'm running tests.


> In order to do in container testing you should check Cactus.

I spent some time looking at Cactus before.  I didn't really like how 
the Maven plugin wanted
to start and stop my server.  Maybe I need to study it a bit more.

But at a glance, it didn't really solve my problem.  I can run my tests 
in the container
fine, my problem is the slightly ugly magic I have to go through in 
order to get my tests deployed.
 From what I remember, Cactus helps with this, but the communication 
channels with the
app server are always the tough part.


> Remember that maven philosophy is "one artifact per project".

If it violates this philosophy then I can see why others would be 
against it.
However, I consider the tests to be a quasi-artifact, and adding a goal 
to produce or
install a test jar seems to be trivial.

But you can also do 'maven jar war ear' and get 3 artifacts right there, 
all derivations of
the same core source tree, so I find this type of situation a bit cloudy.

Thanks for your response.

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


RE: I wish there were test:jar and test:jar-install goals

Posted by Carlos Sanchez <ap...@carlos.cousas.net>.
Hi,

If you are using test utilities and superclasses in different projects (as I
do) you should add them to src/java dir as any other utility classes. This
way they will be packed when calling jar plugin.

In order to do in container testing you should check Cactus.

Remember that maven philosophy is "one artifact per project".


Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net
 

> -----Original Message-----
> From: matthew.hawthorne [mailto:matth@apache.org] 
> Sent: Monday, June 07, 2004 7:26 AM
> To: Maven Users List
> Subject: I wish there were test:jar and test:jar-install goals
> 
> I frequently find myself in situations where I need a 
> "test:jar" and "test:jar-install" goal.  Sometimes I have set 
> of fairly abstract tests that the tests in another subproject 
> depend on.  Other times, I have tests that need to be run in 
> a certain environment (inside of a container), and I need to 
> war.bundle the test jar into a war.
> 
> Currently, my options for doing this are:
> 
> 1) Do some maven.xml magic to build a test jar whenever the 
> main jar is built, and install the test jar whenever the main 
> jar is installed.
> 
> 2) Put the unit tests in a separate project from the classes 
> that they are testing, so they will be in the sourceDirectory 
> instead of the unitTestSourceDirectory, and therefore easy to 
> build and install.
> 
> But, as I've suggested, I think this would be easier if there 
> were goals to build and install test jars.
> 
> Anyone else agree?
> 
> ---------------------------------------------------------------------
> 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