On Tue, 16 Sep 2003, Mark Langley wrote:

> We also desire to make test utility classes (primarily Mock Objects)
> available for use in testing of dependent projects. The approach of creating
> XYZ.jar and XYZ-tests.jar artifacts from project XYZ seems to be the best
> approach to this. Subsequent projects could then prescribe XYX-tests.jar as
> a test-dependency in their project.xml if needed.
>
> I don't think this runs counter to any of the arguments presented on the
> WhyYouCantCreateMultipleArtifactsInOneProject wiki page. Packaging an
> additional jar from the test code need not impact any of the plugins (except
> for a new test:deploy goal), and the build settings need not change. There
> is no risk of recreating the multi-project plugin within a single project.
>
> Alternate suggestion #1 of distributing test code inside a production jar is
> not a realistic solution in many (most?) environments.

Point taken :)

>
> Alternate suggestion #2 of creating a new XYZ-test-support project creates a
> circular dependency - I can't test XYZ without the support classes, and I
> can't build the support classes without XYZ.

I don't follow you here, perhaps you should try to clearify with a example

In your original mail you wanted to create a source distribution and a
test distribution. What is a test distribution?

The src/main/java directory is for the source files of a artifact and the
src/test/java is a set of tests for testing the artifact. They are not
supposed to be general classes for use outside of the artifact.

If you have a set of general test cases/util objects they really belong in
a separate project.

>
> I am curious to learn if the concept of a XYX-tests.jar artifact has been
> discussed before, and if so, why it would be rejected.
>
> Thanks,
>
> Mark
>
>
> -----Original Message-----
> From: Trygve Laugstøl [mailto:[EMAIL PROTECTED]
> Sent: September 16, 2003 3:35 AM
> To: Maven Users List
> Subject: Re: Build problem related to test distribution
>
>
> On Mon, 15 Sep 2003, Gil César Faria wrote:
>
> > Hello everybody!
> >
> > I have a basic project where I have some general utility classes used by
> > all other maven projects.
> > Inside this general project, i have some abstract test classes that
> > should be used within all other
> > test classes of all projects. All test classes, including those abstract
> > classes are under test directory.
> >
> > When maven builds the distribution for this general project, it only
> > includes the source classes, not
> > the test classes. But when i try to build other projects that depends
> > upon this general project, i cannot
> > compile the tests because the abstract test classes cannot be found.
> >
> > I am not sure about the best solution for this problem and would like an
> > advise from our
> > more maven experienced coleagues:
> >
> > Can i generate more than one artifact (jar) for a single project ? some
> > kind of source distribution and test distribution ...
>
> No
>
> http://wiki.codehaus.org/maven/WhyYouCantCreateMultipleArtifactsInOneProject
>
> >
> > Should i generate only a single jar with all source and test classes
> > inside it ?
>
> Don't see why not. The test class isnt a class for testing the artifact,
> rather a part of you general stuff. Bear in mind that the testcase class
> will be included if you end up building war or uberjars.
>
> >
> > Should i create a new project to hold only the abstract test classes,
> > and include it as a dependency for all other projects ?
>
> This is also a solution. Currently you can only state _dependencies_ for a
> project so it doesn't add much value, but with a later version you can
> state runtime/testtime dependencies and then it might be a good idea to
> have it as a separate project.
>
> Guess the rest of your questions are answered by now? :)
>
> >
> > Should i redefine dist:build to create a test distribution ?
> >
> > There is an automated way to tell maven that the test classes should be
> > considered as a dependency ?
> >
> > There is another way to organize my project classes to solve this problem?
> >
> > Can I define source dependencies and test dependencies separatelly?
> >
> > Any other suggestions?
> >
> > Thanks in advance!


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

Reply via email to