Search code examples
mavenmaven-3maven-plugin

Maven cannot find jars of package shipped as war


I want to include (import) some classes from an java package that is shipped as a war in the maven central repository but also has a jar package. Which is why its dependency xml on the mvn repository website is stated as

<dependency>
    <groupId>org.camunda.bpm</groupId>
    <artifactId>camunda-engine-rest</artifactId>
    <version>7.14.0</version>
</dependency>

I use the dependency in my pom and my code compiles successfully. But when I run mvn clean install I get the below error:

Failure to find org.camunda.bpm:camunda-engine-rest:jar:7.14.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Also when I add type war (<type>war</type>) to my dependency, I dont get the above error but now my code wont compile.

It is strange because when I visit https://repo.maven.apache.org/maven2 and navigate to the GAV I can find the jars


Solution

  • The JARs in the directory you showed have classifiers.

    If you need one of them, you must add the classifier to the dependency, e.g.

    <classifier>classes</classifier>

    I don't know Camunda, but I would also look into the documentation. It may be better to use some other approach instead of trying the use a class of a WAR.