You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lee Meador <le...@leemeador.com> on 2009/09/10 23:08:42 UTC
Re: how to prevent modules from having internal cyclic package
dependencies
Would it bother you to have a test dependency to mymodules-test.jar
(assuming that is a jar built in its own project with its own POM. With a
test dependency it won't be in your deployable but will be used during the
test phase of the build.
-- Lee
On Wed, Sep 9, 2009 at 1:55 PM, <to...@gi-de.com> wrote:
> Hi,
>
> for one of my modules I´ve written a "JDependCycleTest" that checks the
> internal packages from not having cyclic dependencies.
>
> ...
> JDepend jdepend = new JDepend();
> jdepend.addDirectory(...);
>
> Collection col = jdepend.analyze();
> for (Iterator iter = col.iterator(); iter.hasNext();)
> {
> JavaPackage p = (JavaPackage) iter.next();
>
> List<JavaPackage> cycles = new ArrayList<JavaPackage>();
> p.collectCycle(cycles);
>
> Assert.assertNotNull(p);
> if( cycles.size() > 0)
> {
> Assert.fail("Cycle exists at package " + p.getName() + ":
> " + toString(cycles));
> }
> }
> ..
>
> I want to check this in other modules too, without
> - copying the Junit Test to other modules
> - introducing a dependency to mymodules-test.jar
>
> Is there any plugin, that has this (JDepend) feature?
> Or any other idea, to check in general for cyclic dependencies in all
> modules?
>
> Thanx, Torsten
>
--
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com