Hi,

If I set these dependencies to 'provided' I have not been able to ensure
they are actually inserted (and relocated) into the final shaded jar file.

Niels

On Fri, Jul 8, 2022 at 6:36 PM Jörg Schaible <joerg.schai...@gmx.de> wrote:

> Hi,
>
> simply declare the dependency with scope "provided" in the project that
> shades
> it.
>
> Regards,
> Jörg
>
> On Fritday, 8. July 2022, 17:43:16 CEST Francois Marot wote:
> > Hello Niels,
> >
> > I believe you used the shade maven plugin or equivalent. I faced this
> > problem multiple times and to my knowledge, there is no "good" solution.
> > The problem is that Maven computes the dependency graph for all modules
> of
> > the reactor right at the start. But when the shade plugin integrates
> ANTLR
> > inside your library, this library should not depend onto ANTLR anymore.
> But
> > because the dependency graph was computed at the start,
> > other modules of the reactor depending onto your library still depend
> onto
> > ANTLR even if there is already a shaded version of ANTLR inside your
> > library.
> >
> > So in the end, in the same reactor execution, module MUST NOT depend
> onto a
> > shaded module. They must be considered as 'final' modules.
> >
> > I hope this may help
> > François
> >
> >
> > *- - - - -François Marot06 50 91 96 38*
> >
> > Le ven. 8 juil. 2022 à 16:51, Niels Basjes <ni...@basjes.nl> a écrit :
> > > Hi,
> > >
> > > I have a library project that uses dependencies that are prone to cause
> > > conflicts when another project wants to use my software.
> > > Antlr4 is a common example because it enforces the versions of the
> > > generated code and the runtime to be an exact match.
> > >
> > > In my maven project I have a main library and to avoid conflicts in
> > > downstream applications the antlr4-runtime has been shaded and
> relocated
> > > to
> > > a different package name.
> > > Using this modified jar in any project works as expected.
> > >
> > > When I want to use this in a different maven module of the same
> project it
> > > does not work like that.
> > > In my multi module maven project I found that the other modules (UDFs,
> > > demo
> > > webservlet, etc)  use the unshaded variant of the library, which
> sometimes
> > > causes conflicts.
> > > I think this is how the maven reactor is intended to work.
> > >
> > > Essentially I think I want to have the option to make a specific
> module of
> > > my project be built as-if it is an external project (i.e. "outside" the
> > > reactor).
> > >
> > > So far I have only found the invoker plugin to be a way to make this
> > > happen.
> > >
> > > What is the recommended way to handle this?
> > >
> > > --
> > > Best regards / Met vriendelijke groeten,
> > >
> > > Niels Basjes
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

-- 
Best regards / Met vriendelijke groeten,

Niels Basjes

Reply via email to