IIUC, you have a unique parent pom (likely a "corporate pom"), let's can
him P. P says scope is test for groovy-all.

You have modules m1, m2... who all inherits P.

In some module mN, you need groovy-all with scope compile.

But m1 actually depends on mN and will crash since the dependency onto
groovy-all isn't retrieved?

If so, then this is expected. Dependency mgmt overrides the dependencies
scope. One possible solution to centralize many redefinitions is to create
an intermediate parent for those modules where you need groovy-all with
scope compile.
I think that's what Mirko was proposing.

Does that help?
Le 28 mars 2014 15:08, "Mirko Friedenhagen" <mfriedenha...@gmail.com> a
écrit :

> Alexander,
>
> AFAIK you may override the scope in the inheriting poms. If I remember
> correctly I did this with junit as I needed it for an selenium test
> project, where I had put base tests beneath src/main (to recite Brecht: oh,
> don't ask why).
>
> Regards
> Mirko
> --
> Sent from my mobile
> On Mar 28, 2014 2:59 PM, "Alexander Kriegisch" <alexan...@kriegisch.name>
> wrote:
>
> > I have a situation as follows:
> >
> >   - Multi-module project (~30 modules)
> >
> >   - Certain test dependencies (e.g. groovy-all) needed by nearly all
> >     sub-modules are declared directly with test scope in the parent POM
> >     (not just dependencyManagement, but also dependency). I know this is
> >     considered to be bad practice but it saves a lot of redundant
> >     dependency duplication.
> >
> >   - One new sub-module now actually also needs groovy-all, but with a
> >     compile scope. So my wish (although seemingly unsupported by Maven)
> >     is to override the default scope for this sub-module so as for the
> >     dependency to be actually available during runtime.
> >
> > How can I do this or work around the need to duplicate my test
> > dependencies in 30 modules just so as to be able to define the scope for
> > the new module? AFAIK a POM can only inherit from one POM. But can I
> > somehow use an "included POM" in my 30 modules in order to be able to
> > centrally manage the test dependencies? Sorry if I am explaining this
> > wrong or using incorrect erms, but I am by no means a Maven pro.
> > Hopefully I was at least able to make my intent clear. I am looking for
> > good advice beyond lecturing about how I should really, really declare
> > everything 30 times in order to do it the Maven way. I am looking for
> > alternatives, am willing to learn and hoping to get constructive answers.
> >
> > Thanks you all in advance
> > --
> > Alexander Kriegisch
> >
> >
> >
>

Reply via email to