Home > Mobile >  How to add CometD 5x and above jars to Maven project
How to add CometD 5x and above jars to Maven project

Time:07-19

I’m not a Java developer, but I find myself having to update an old Maven Java command line project that uses a cometd 4x client library. Every since version 5x, cometd libraries inside the main Maven repo contain only pom.xml files, but no jar files (for instance https://repo1.maven.org/maven2/org/cometd/java/cometd-java-client/7.0.7/), so I cannot simply add this entry to my pom.xml:

<dependency>
    <groupId>org.cometd.java</groupId>
    <artifactId>cometd-java-client</artifactId>
    <version>7.0.7</version>
</dependency>

The cometd official site does provide a .tar.gz file with all the needed jars (https://download.cometd.org/), and in a folder hierarchy that resembles a maven repo, but I could not find instructions on how to use it properly.

The official documentation only focuses on server implementations which have a ton of extra dependencies (https://docs.cometd.org/current7/reference/#_deploying_your_cometd_application).

Can I add the contents of the .tar.gz file as a local maven repo or as a module of my current project? And how do I do that exactly? Right now I’m trying a solution form this answer (Can I add jars to Maven 2 build classpath without installing them?), but there are so many manual steps that I believe there must be a better way to do it.

CodePudding user response:

Please follow the migration guide from 4.x to 5.x here (and also the other migration guides since you're jumping from 4.x to 7.x).

In particular, 4.x artifact cometd-java-client has been split since CometD 5.x into multiple different implementations that now you have to specify explicitly, for example cometd-java-client-http-jetty for the equivalent used in 4.x, or the new cometd-java-client-http-okhttp.

  • Related