java maven dependency management and versions

I removed my dependency issues with the shaded jar plugin by switching to slimfast. The shaded jar included way too many libraries which all interfered with each other, causing hours of work to resolve. Slimfast installed in a couple hours and solved all my issues.

https://github.com/HubSpot/SlimFast/blob/master/slimfast-plugin/README.md

working on com.mydetv.swarm- had issues with too many conflicts.
but I seem to be already using slimfast. Now to dig in…

w01:repository phomlish$ ls com/google/inject/guice
3.0 4.1.0 5.0.1

Let’s go stamp these out…
mvn dependency:tree -Dverbose > deptree.txt

I fixed so packaging shared gives:
w01:repository phomlish$ ls com/google/inject/guice
5.0.1

broadcast is the big culprit:
w01:repository phomlish$ ls com/google/inject/guice
3.0 4.1.0 5.0.1

I suspected broadcast might still be bringing in the old shared, so I bumped the version of shared and
w01:shared phomlish$ mvn clean package install

the above didn’t help, but I think it could have if something was conflicting in the old shared, so still probably a good idea to do it

w01:broadcast phomlish$ mvn clean package
w01:repository phomlish$ ls com/google/inject/guice
3.0 4.1.0 5.0.1

mvn dependency:tree -Dverbose > deptree.txt
here we have our culprits:

INFO] +- com.google.inject.extensions:guice-servlet:jar:4.1.0:compile
[INFO] | \- (com.google.inject:guice:jar:4.1.0:compile – omitted for conflict with 5.0.1)

[INFO] +- com.google.inject.extensions:guice-spring:jar:4.1.0:compile
[INFO] | \- (com.google.inject:guice:jar:4.1.0:compile – omitted for conflict with 5.0.1)

+- org.glassfish.hk2:guice-bridge:jar:2.5.0-b15:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | +- (org.glassfish.hk2:hk2-api:jar:2.5.0-b15:compile – omitted for conflict with 2.5.0-b32)
[INFO] | \- (com.google.inject:guice:jar:3.0:compile – omitted for conflict with 5.0.1)

one at a time:
com.google.inject.extensions:guice-servlet
com.google.inject.extensions:guice-spring:jar
those were easy- they had a 5.0.1

cool, we stamped out 4.1.0:
w01:repository phomlish$ ls com/google/inject/guice
3.0 5.0.1

now for org.glassfish.hk2:guice-bridge.
I was specifying version 2.5.0-b15 and 3.0.1 is available so we’ll try it.

No joy:
w01:repository phomlish$ ls com/google/inject/guice
4.2.2 5.0.1

decisions decisions. Try to downgrade to guice 4.2.2 or find a new guice-bridge? That thing is a damn black box. I remember coding it the first time. It’s an automagic thing to fix up the injections in the html code.
Yeah, it’s dead code not updated in 3 years.

This project is now part of the EE4J initiative. This repository has been archived as all activities are now happening in the corresponding Eclipse repository. See here for the overall EE4J transition status.

Screw you Oracle, both are dead links!

took some googling, but looks like that’s a big project.
https://stackoverflow.com/questions/52658991/migrate-jersey-project-to-use-java-10-results-in-java-lang-illegalargumentexcept/52660446#52660446

We’ll try to go with 4.2.2.
we got it for broadcast!
w01:repository phomlish$ ls com/google/inject/guice
4.2.2

built everything and it seems to be ok, but now it won’t even run in eclipse. That damn glassfish bridge!

2021-03-27 06:55:32,839 WARN org.eclipse.jetty.server.handler.ContextHandler.api [httpEmbedded] 2355 ~ unavailable
java.lang.IllegalArgumentException: null
at org.glassfish.hk2.utilities.ServiceLocatorUtilities.addOneConstant(ServiceLocatorUtilities.java:236)
at org.jvnet.hk2.guice.bridge.internal.GuiceIntoHK2BridgeImpl.bridgeGuiceInjector(GuiceIntoHK2BridgeImpl.java:46)
at broadcast.web.GuiceFeature.configure(GuiceFeature.java:29)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:730)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:648)
at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:347)
at org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:671)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:428)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:750)
at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:313)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:744)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:369)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
at org.eclipse.jetty.server.Server.start(Server.java:415)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:382)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at broadcast.web.HttpEmbedded.run(HttpEmbedded.java:133)
at java.lang.Thread.run(Thread.java:748)
2021-03-27 06:55:32,846 INFO org.eclipse.jetty.server.AbstractConnector [httpEmbedded] 292 ~ Started ServerConnector@4f74d60a{SSL,[ssl, http/1.1]}{0.0.0.0:8991}
2021-03-27 06:55:32,846 ERROR broadcast.web.HttpEmbedded [httpEmbedded] 138 ~ exception:javax.servlet.ServletException: org.glassfish.jersey.servlet.ServletContainer-645e75cc@e157ff5a==org.glassfish.jersey.servlet.ServletContainer,jsp=null,order=-1,inst=false,async=true
2021-03-27 06:55:32,847 INFO broadcast.ShutdownHook [Thread-36] 22 ~ starting gracefull shutdown

That’ll take a whole new post.
Now I want to upgrade my eclipse IDE, java to 11, and jetty and jersey

Leave a Reply

Your email address will not be published. Required fields are marked *