You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Manfred Moser <ma...@mosabuam.com> on 2012/06/09 07:16:28 UTC
Re: Maven cyclic dependency when compling tests only - how to
resolve easily?
Pull the test code out into a separate module that makes everything
available you need in there.. and run the test there.
manfred
http://simpligility.com
On Fri, June 8, 2012 9:32 pm, Ken E wrote:
> I am working on modernizing an older project to be used with Maven. The
> project is very large and has around 30 modules in it.
>
> As far as the main source code is concerned, I managed to get all of it to
> compile and establish the dependencies correctly. It actually works and it
> can be run through Maven's tomcat plugin.
>
> The problem is with compiling the tests.
>
> Unfortunately, this company did not apply the same dependency restrictions
> for their test code as they did with their main source code.
>
> For example, C depends on B, and B depends on A in the main source code.
> However, A depends on C to run its tests. Obviously, Maven is going to
> complain and say there is a cyclic dependency.
>
> Besides out-right fixing the code (which is sadly not going to happen on
> this project - it's tens of millions of lines), is there any way to tell
> Maven, "Please compile ALL of the main source code first, then compile ALL
> of the test code afterward" ? Or is there any other solution around this
> problem?
>
> Many Thanks,
> Ken
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven cyclic dependency when compling tests only - how to resolve easily?
Posted by Ken E <ke...@gmail.com>.
Thanks for the response Anders.
I agree that for integration tests, this wouldn't seem weird at all.
Unfortunately, they are actually unit tests, not integration tests. They
wrote their own "everything" - o/r mapper, unit test framework, middle-tier
software, etc. - and unfortunately all of this code is now used everywhere
and is intermixed with actual application-specific code :(
I will start creating separate test modules right now. I hope it's smooth
sailing. Hopefully I won't have any trouble.
Thanks!
Ken
On Sat, Jun 9, 2012 at 4:08 AM, Anders Hammar <an...@hammar.net> wrote:
> No, you create a separate module that just holds the tests. Due to the
> different dependencies for these tests I assume they are not unit
> tests but rather some sort of integration tests. Having a separate
> module for ITs is very common. I'd even go as far as saying it's best
> practice.
>
> /Anders
>
> On Sat, Jun 9, 2012 at 7:31 AM, Ken E <ke...@gmail.com> wrote:
> > That might work.
> >
> > Where do I put the second pom.xml for the tests then?
> >
> > The directory structure is like this:
> >
> > /main-project/pom.xml (contains all modules: moduleA -> moduleX)
> > /main-project/moduleA/pom.xml
> > /main-project/moduleA/src
> > /main-project/moduleA/test/src
> > ....
> >
> > So I put another pom.xml in /main-project/moduleA/test?
> >
> > Ken
> >
> >
> > On Sat, Jun 9, 2012 at 1:16 AM, Manfred Moser <ma...@mosabuam.com>
> wrote:
> >
> >> Pull the test code out into a separate module that makes everything
> >> available you need in there.. and run the test there.
> >>
> >> manfred
> >> http://simpligility.com
> >>
> >> On Fri, June 8, 2012 9:32 pm, Ken E wrote:
> >> > I am working on modernizing an older project to be used with Maven.
> The
> >> > project is very large and has around 30 modules in it.
> >> >
> >> > As far as the main source code is concerned, I managed to get all of
> it
> >> to
> >> > compile and establish the dependencies correctly. It actually works
> and
> >> it
> >> > can be run through Maven's tomcat plugin.
> >> >
> >> > The problem is with compiling the tests.
> >> >
> >> > Unfortunately, this company did not apply the same dependency
> >> restrictions
> >> > for their test code as they did with their main source code.
> >> >
> >> > For example, C depends on B, and B depends on A in the main source
> code.
> >> > However, A depends on C to run its tests. Obviously, Maven is going to
> >> > complain and say there is a cyclic dependency.
> >> >
> >> > Besides out-right fixing the code (which is sadly not going to happen
> on
> >> > this project - it's tens of millions of lines), is there any way to
> tell
> >> > Maven, "Please compile ALL of the main source code first, then compile
> >> ALL
> >> > of the test code afterward" ? Or is there any other solution around
> this
> >> > problem?
> >> >
> >> > Many Thanks,
> >> > Ken
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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: Maven cyclic dependency when compling tests only - how to resolve easily?
Posted by Anders Hammar <an...@hammar.net>.
No, you create a separate module that just holds the tests. Due to the
different dependencies for these tests I assume they are not unit
tests but rather some sort of integration tests. Having a separate
module for ITs is very common. I'd even go as far as saying it's best
practice.
/Anders
On Sat, Jun 9, 2012 at 7:31 AM, Ken E <ke...@gmail.com> wrote:
> That might work.
>
> Where do I put the second pom.xml for the tests then?
>
> The directory structure is like this:
>
> /main-project/pom.xml (contains all modules: moduleA -> moduleX)
> /main-project/moduleA/pom.xml
> /main-project/moduleA/src
> /main-project/moduleA/test/src
> ....
>
> So I put another pom.xml in /main-project/moduleA/test?
>
> Ken
>
>
> On Sat, Jun 9, 2012 at 1:16 AM, Manfred Moser <ma...@mosabuam.com> wrote:
>
>> Pull the test code out into a separate module that makes everything
>> available you need in there.. and run the test there.
>>
>> manfred
>> http://simpligility.com
>>
>> On Fri, June 8, 2012 9:32 pm, Ken E wrote:
>> > I am working on modernizing an older project to be used with Maven. The
>> > project is very large and has around 30 modules in it.
>> >
>> > As far as the main source code is concerned, I managed to get all of it
>> to
>> > compile and establish the dependencies correctly. It actually works and
>> it
>> > can be run through Maven's tomcat plugin.
>> >
>> > The problem is with compiling the tests.
>> >
>> > Unfortunately, this company did not apply the same dependency
>> restrictions
>> > for their test code as they did with their main source code.
>> >
>> > For example, C depends on B, and B depends on A in the main source code.
>> > However, A depends on C to run its tests. Obviously, Maven is going to
>> > complain and say there is a cyclic dependency.
>> >
>> > Besides out-right fixing the code (which is sadly not going to happen on
>> > this project - it's tens of millions of lines), is there any way to tell
>> > Maven, "Please compile ALL of the main source code first, then compile
>> ALL
>> > of the test code afterward" ? Or is there any other solution around this
>> > problem?
>> >
>> > Many Thanks,
>> > Ken
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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: Maven cyclic dependency when compling tests only - how to resolve easily?
Posted by Ken E <ke...@gmail.com>.
That might work.
Where do I put the second pom.xml for the tests then?
The directory structure is like this:
/main-project/pom.xml (contains all modules: moduleA -> moduleX)
/main-project/moduleA/pom.xml
/main-project/moduleA/src
/main-project/moduleA/test/src
....
So I put another pom.xml in /main-project/moduleA/test?
Ken
On Sat, Jun 9, 2012 at 1:16 AM, Manfred Moser <ma...@mosabuam.com> wrote:
> Pull the test code out into a separate module that makes everything
> available you need in there.. and run the test there.
>
> manfred
> http://simpligility.com
>
> On Fri, June 8, 2012 9:32 pm, Ken E wrote:
> > I am working on modernizing an older project to be used with Maven. The
> > project is very large and has around 30 modules in it.
> >
> > As far as the main source code is concerned, I managed to get all of it
> to
> > compile and establish the dependencies correctly. It actually works and
> it
> > can be run through Maven's tomcat plugin.
> >
> > The problem is with compiling the tests.
> >
> > Unfortunately, this company did not apply the same dependency
> restrictions
> > for their test code as they did with their main source code.
> >
> > For example, C depends on B, and B depends on A in the main source code.
> > However, A depends on C to run its tests. Obviously, Maven is going to
> > complain and say there is a cyclic dependency.
> >
> > Besides out-right fixing the code (which is sadly not going to happen on
> > this project - it's tens of millions of lines), is there any way to tell
> > Maven, "Please compile ALL of the main source code first, then compile
> ALL
> > of the test code afterward" ? Or is there any other solution around this
> > problem?
> >
> > Many Thanks,
> > Ken
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>