You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tim Dysinger <ti...@supplychainge.com> on 2005/09/27 21:04:32 UTC
Cross-project dependencies on unit test code
I have a "best practices" question.
I have a multi-project setup with three sub-projects. Two of the
sub-projects have tests which subclass tests in the "core" project.
However, just having the sub-projects depend on "core" does not expose
the unit test code and the build fails with a compilation error.
If I put the unit tests into the src/java directory, then the eclipse
plugin generates duplicate source directories "src/java" in
the .classpath file.
I imagine that I could break out all the tests into other sub-projects
but that seems clumsy and would double the number of projects in my
multi-project setup.
How do I deal with this elegantly?
-Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Cross-project dependencies on unit test code
Posted by Trygve Laugstøl <tr...@codehaus.org>.
On Wed, 2005-09-28 at 09:39 -0700, Tim Dysinger wrote:
> Ok. Let's say we did it that way. We are still faced with the same
> problem with the maven-eclipse-plugin. Maven-eclipse-plugin does not
> like having your source and test directories the same.
>
> <sourceDirectory>${basedir}/src/java</sourceDirectory>
> <unitTestSourceDirectory>${basedir}/src/java</unitTestSourceDirectory>
>
> I can't do this without using eclipse. The plugin, in this case, would
> generate a bogus .classpath file.
That is a bug, please file an issue in JIRA[1].
> Putting the junit code in src/java is the only way I know that maven
> will publish your jar so other projects can depened on it. If you just
> put your tests in src/test, maven will publish an empty jar and the
> dependant project will fail to compile.
See [2].
Though I don't think you understood what Raphaël meant. He was
suggesting that you make a separate project containing your test code,
which would result in two separate Maven and Eclipse projects.
[1]: http://jira.codehaus.org/browse/MNG
[2]: http://jira.codehaus.org/browse/MNG-932
--
Trygve
> -Tim
>
> On Wed, 2005-09-28 at 08:42 +1000, Brett Porter wrote:
> > This has been asked 2 or 3 times this week. IIRC someone was going to
> > write up their experience doing it? Would anyone like to volunteer to
> > add it to the wiki?
> >
> > - Brett
> >
> > On 9/28/05, Raphaël Piéroni <ra...@gmail.com> wrote:
> > > Hi Tim,
> > >
> > > May you try with something like this :
> > > wrapper
> > > +- core-api
> > > +- core-test (depend only on api)
> > > +- core-impl (with some test cases - depends on core-api and core-test
> > > the later with scope test)
> > > +- use-core-1 (depend on core-impl, depends on core-test at scope test -
> > > the test cases must not depend on core-impl's tests)
> > > +- use-core-2 (...)
> > >
> > > Then you move all the common test practices to the core-test project.
> > >
> > > May that helps.
> > >
> > > Regards,
> > >
> > > Raphaël.
> > >
> > > Tim Dysinger a écrit :
> > >
> > > >I have a "best practices" question.
> > > >
> > > >I have a multi-project setup with three sub-projects. Two of the
> > > >sub-projects have tests which subclass tests in the "core" project.
> > > >However, just having the sub-projects depend on "core" does not expose
> > > >the unit test code and the build fails with a compilation error.
> > > >
> > > >If I put the unit tests into the src/java directory, then the eclipse
> > > >plugin generates duplicate source directories "src/java" in
> > > >the .classpath file.
> > > >
> > > >I imagine that I could break out all the tests into other sub-projects
> > > >but that seems clumsy and would double the number of projects in my
> > > >multi-project setup.
> > > >
> > > >How do I deal with this elegantly?
> > > >
> > > >-Tim
> > > >
> > > >
> > > >
> > > >---------------------------------------------------------------------
> > > >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
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Cross-project dependencies on unit test code
Posted by Tim Dysinger <ti...@supplychainge.com>.
Ok. Let's say we did it that way. We are still faced with the same
problem with the maven-eclipse-plugin. Maven-eclipse-plugin does not
like having your source and test directories the same.
<sourceDirectory>${basedir}/src/java</sourceDirectory>
<unitTestSourceDirectory>${basedir}/src/java</unitTestSourceDirectory>
I can't do this without using eclipse. The plugin, in this case, would
generate a bogus .classpath file.
Putting the junit code in src/java is the only way I know that maven
will publish your jar so other projects can depened on it. If you just
put your tests in src/test, maven will publish an empty jar and the
dependant project will fail to compile.
-Tim
On Wed, 2005-09-28 at 08:42 +1000, Brett Porter wrote:
> This has been asked 2 or 3 times this week. IIRC someone was going to
> write up their experience doing it? Would anyone like to volunteer to
> add it to the wiki?
>
> - Brett
>
> On 9/28/05, Raphaël Piéroni <ra...@gmail.com> wrote:
> > Hi Tim,
> >
> > May you try with something like this :
> > wrapper
> > +- core-api
> > +- core-test (depend only on api)
> > +- core-impl (with some test cases - depends on core-api and core-test
> > the later with scope test)
> > +- use-core-1 (depend on core-impl, depends on core-test at scope test -
> > the test cases must not depend on core-impl's tests)
> > +- use-core-2 (...)
> >
> > Then you move all the common test practices to the core-test project.
> >
> > May that helps.
> >
> > Regards,
> >
> > Raphaël.
> >
> > Tim Dysinger a écrit :
> >
> > >I have a "best practices" question.
> > >
> > >I have a multi-project setup with three sub-projects. Two of the
> > >sub-projects have tests which subclass tests in the "core" project.
> > >However, just having the sub-projects depend on "core" does not expose
> > >the unit test code and the build fails with a compilation error.
> > >
> > >If I put the unit tests into the src/java directory, then the eclipse
> > >plugin generates duplicate source directories "src/java" in
> > >the .classpath file.
> > >
> > >I imagine that I could break out all the tests into other sub-projects
> > >but that seems clumsy and would double the number of projects in my
> > >multi-project setup.
> > >
> > >How do I deal with this elegantly?
> > >
> > >-Tim
> > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >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
> >
> >
>
> ---------------------------------------------------------------------
> 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
Re: Cross-project dependencies on unit test code
Posted by Brett Porter <br...@gmail.com>.
This has been asked 2 or 3 times this week. IIRC someone was going to
write up their experience doing it? Would anyone like to volunteer to
add it to the wiki?
- Brett
On 9/28/05, Raphaël Piéroni <ra...@gmail.com> wrote:
> Hi Tim,
>
> May you try with something like this :
> wrapper
> +- core-api
> +- core-test (depend only on api)
> +- core-impl (with some test cases - depends on core-api and core-test
> the later with scope test)
> +- use-core-1 (depend on core-impl, depends on core-test at scope test -
> the test cases must not depend on core-impl's tests)
> +- use-core-2 (...)
>
> Then you move all the common test practices to the core-test project.
>
> May that helps.
>
> Regards,
>
> Raphaël.
>
> Tim Dysinger a écrit :
>
> >I have a "best practices" question.
> >
> >I have a multi-project setup with three sub-projects. Two of the
> >sub-projects have tests which subclass tests in the "core" project.
> >However, just having the sub-projects depend on "core" does not expose
> >the unit test code and the build fails with a compilation error.
> >
> >If I put the unit tests into the src/java directory, then the eclipse
> >plugin generates duplicate source directories "src/java" in
> >the .classpath file.
> >
> >I imagine that I could break out all the tests into other sub-projects
> >but that seems clumsy and would double the number of projects in my
> >multi-project setup.
> >
> >How do I deal with this elegantly?
> >
> >-Tim
> >
> >
> >
> >---------------------------------------------------------------------
> >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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Cross-project dependencies on unit test code
Posted by Raphaël Piéroni <ra...@gmail.com>.
Hi Tim,
May you try with something like this :
wrapper
+- core-api
+- core-test (depend only on api)
+- core-impl (with some test cases - depends on core-api and core-test
the later with scope test)
+- use-core-1 (depend on core-impl, depends on core-test at scope test -
the test cases must not depend on core-impl's tests)
+- use-core-2 (...)
Then you move all the common test practices to the core-test project.
May that helps.
Regards,
Raphaël.
Tim Dysinger a écrit :
>I have a "best practices" question.
>
>I have a multi-project setup with three sub-projects. Two of the
>sub-projects have tests which subclass tests in the "core" project.
>However, just having the sub-projects depend on "core" does not expose
>the unit test code and the build fails with a compilation error.
>
>If I put the unit tests into the src/java directory, then the eclipse
>plugin generates duplicate source directories "src/java" in
>the .classpath file.
>
>I imagine that I could break out all the tests into other sub-projects
>but that seems clumsy and would double the number of projects in my
>multi-project setup.
>
>How do I deal with this elegantly?
>
>-Tim
>
>
>
>---------------------------------------------------------------------
>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