You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Tim Boudreau <ni...@gmail.com> on 2019/11/15 21:14:26 UTC

Re: NetBeans app with Maven with 3rd party libs

The answer depends on whether the gitlab4j, batik and awsamazon libraries
will pass around objects created by commons-logging such that they will
collide (and not have the same Class objects).

If not, just wrap each one in its own wrapper module along with the version
of commons-logging they want, and each one should load its own copy of
commons-logging, and life is good (just be very sure YOUR code doesn't try
to call into commons-logging, or bad things will happen).

If that doesn't work, try to find the newest version of commons-logging
that is compatible with all of them, and:  Create your one or multiple
wrapper modules, but in each one's pom.xml, *exclude* the dependency on
commons-logging, and add an explicit dependency from your wrapper module to
the version of commons-logging that all of them can share.

If there is no version of commons-logging that works with all of those
libraries, see if you can isolate individual libraries so they use the
version they want as described above, until you have something that works.

It ain't pretty.

-Tim

On Thu, Oct 31, 2019 at 11:46 AM Matteo Di Giovinazzo <ma...@gmail.com>
wrote:

> Any thoughts about this question of mine?
>
> I read lately some old thread about converting the contrib plugins to
> Maven:
>
> https://lists.apache.org/thread.html/38228ec0bd9f47b014d9b7cff72665285c6227d39726373be6c7b82b@%3Cdev.netbeans.apache.org%3E
>
>
> Any hint you can give us, Tim Boudreau?
>
> Thanks in advance!
> -Matteo
>
> On Fri, 25 Oct 2019 at 11:56, Matteo Di Giovinazzo <ma...@gmail.com>
> wrote:
>
> > Thanks, yes but what about the case we have in our RCP app: we use
> > gitlab4j, batik and awsamazon libraries and they share dependencies on
> > commons-logging with 3 different versions and other shared dependencies?
> > Is creating different NBM modules by hand trying to group as much jars as
> > possible and at the same time minimize the redundancy of including the
> same
> > jars multiple times the only solution at the moment?
> >
> > On Fri, 25 Oct 2019 at 09:19, Eric Barboni <sk...@apache.org> wrote:
> >
> >> Hi,
> >>
> >> You may group more than on artifacts in one wrapper.  And you don't have
> >> to do  wrapper for every artefacts
> >> If you wrap batik, it's about 10 maven artefacts, but you may have just
> >> one wrapper for all of them.
> >> It depends usage
> >>
> >> Regards
> >> Eric
> >>
> >> -----Message d'origine-----
> >> De : Matteo Di Giovinazzo <ma...@gmail.com>
> >> Envoyé : vendredi 25 octobre 2019 16:22
> >> À : dev@netbeans.apache.org
> >> Objet : Re: NetBeans app with Maven with 3rd party libs
> >>
> >> Thanks Timon for the suggestion!
> >> I am used to follow that way using the Ant-based NetBeans
> >> module/suite/application projects, but I was hoping with Maven that
> could
> >> be avoided given that Maven takes care of dependencies itself. I guess
> the
> >> problem is that Maven dependencies are transitive whereas NetBeans ones
> are
> >> not. I was in fact reading this
> >> https://bits.netbeans.org/mavenutilities/nbm-maven-plugin/  hoping
> >> something clever was going to happen.
> >>
> >> Our current problem is that we have 50+ libraries to ship with our RCP
> >> application and some of them have very log chain of dependencies and
> >> handling all the dependency graph by hand is a nightmare...
> >>
> >> Any other suggestions?
> >> Thanks!
> >>
> >>
> >>
> >>
> >> On Fri, 25 Oct 2019 at 02:31, Timon Veenstra <mo...@gmail.com> wrote:
> >>
> >> > Hi Matteo,
> >> >
> >> > The way to share dependencies between netbeans platform modules is to
> >> > create library wrapper modules.
> >> > - Create a new netbeans platform module
> >> > - add the dependency
> >> > - declare public packages
> >> >
> >> > A little more elaborate description can be found here:
> >> >
> >> >
> https://ljelonek.wordpress.com/2011/04/19/netbeans-maven-library-wrapp
> >> > er-modules/
> >> >
> >> > Cheers,
> >> > Timon
> >> >
> >> > On Thu, Oct 24, 2019 at 7:29 PM Matteo Di Giovinazzo
> >> > <ma...@gmail.com>
> >> > wrote:
> >> >
> >> > > I'm trying to mavenize our NB RCP app, but I do not understand how
> >> > > to add 3rd party libraries.
> >> > > I have an app (nbappmaven) with two modules (module1 and module2)
> >> > > and
> >> > both
> >> > > need the same library, say gitlab4j (with all dependencies is about
> >> > > 7 MB
> >> > of
> >> > > jars).
> >> > >
> >> > > I tried several approaches but without luck:
> >> > >
> >> > >    1. I declared the dependency in both modules but I ended up with
> >> the
> >> > >    needed jars in both these folders:
> >> > >       -
> >> > >
> >> > >
> >> > nbappmaven\application\target\nbappmaven\nbappmaven\modules\ext\com.my
> >> > company.module1
> >> > >       -
> >> > >
> >> > >
> >> > nbappmaven\application\target\nbappmaven\nbappmaven\modules\ext\com.my
> >> > company.module2
> >> > >    2. I declared the dependency in the application Maven project,
> >> > > but it
> >> > is
> >> > >    not picked up by the two modules...
> >> > >    3. I declared the dependency in the parent Maven project
> >> > >    (nbappmaven-parent), but now I have the jars in 3 folders...
> >> > >       -
> >> > >
> >> > >
> >> > nbappmaven\application\target\nbappmaven\nbappmaven\modules\ext\com.my
> >> > company.module1
> >> > >       -
> >> > >
> >> > >
> >> > nbappmaven\application\target\nbappmaven\nbappmaven\modules\ext\com.my
> >> > company.module2
> >> > >       -
> >> > >
> >> > >
> >> > nbappmaven\application\target\nbappmaven\nbappmaven\modules\ext\com.my
> >> > company.nbappmaven-branding
> >> > >
> >> > > Is there a suggested approach in this case? I guess it will be
> >> > > pretty common to share the same library among different modules, no?
> >> > >
> >> > > Thanks for any hint!
> >> > >
> >> > > Best,
> >> > > --
> >> > > Matteo Di Giovinazzo
> >> > >
> >> >
> >>
> >>
> >> --
> >> Matteo Di Giovinazzo
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> >> For additional commands, e-mail: dev-help@netbeans.apache.org
> >>
> >> For further information about the NetBeans mailing lists, visit:
> >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> >>
> >>
> >>
> >>
> >
> > --
> > Matteo Di Giovinazzo
> >
>
>
> --
> Matteo Di Giovinazzo
>


-- 
http://timboudreau.com