Search code examples
javamavenjitpack

JitPack Maven PluginResolutionException


i want to use https://github.com/NiklasHoltmeyer/maven-endpointscoverage

without having to clone it:

https://jitpack.io/#NiklasHoltmeyer/maven-endpointscoverage

Pom.xml:

<project ...

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <!--
                 <groupId>de.hsos.bachelorarbeit.nh</groupId>
                  <artifactId>endpointscoverage-maven-plugin</artifactId>
                  <version>1.0.0</version>
                  -->
                <groupId>com.github.NiklasHoltmeyer</groupId>
                <artifactId>maven-endpointscoverage</artifactId>
                <version>1.0.0</version>
                ... config ..
            </plugin>
...

[ERROR] Plugin com.github.NiklasHoltmeyer:maven-endpointscoverage:1.0.0 or one of its dependencies could not be resolved: Could not find artifact com.github.NiklasHoltmeyer:maven-endpointscoverage:jar:1.0.0 in central (https://repo.maven.apache.org/maven2) -> [
Help 1]

If i compile the Plugin and change the groupId / artifactId according to everything inside the Commentblock it works..

I also tried the following versions:

  • 1.0.0
  • master
  • master-f2d0242df8-1
  • master-SNAPSHOT
  • -SNAPSHOT
  • RELEASE
  • LATEST

It would be great if someone could help me

Edit:

new Pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </pluginRepository>
    </pluginRepositories>

   <build>
        <plugins>
        ...
            <plugin>
                <groupId>com.github.NiklasHoltmeyer</groupId>
                <artifactId>maven-endpointscoverage</artifactId>
                <version>1.0.0</version>
                ...

mvn dependency:resolve-plugins

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.0.2:resolve-plugins (default-cli) on project vet: org.eclipse.aether.resolution.DependencyResolutionException: Failure to find com.github.NiklasHoltmeyer:maven-endpointscoverage:j
ar:1.0.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 -> [Help 1]

mvn clean install -U

[ERROR] Invalid plugin descriptor for com.github.NiklasHoltmeyer:maven-endpointscoverage:1.0.0 (C:\Users\nikla\.m2\repository\com\github\NiklasHoltmeyer\maven-endpointscoverage\1.0.0\maven-endpointscoverage-1.0.0.jar), Plugin's descriptor contains the wrong gro
up ID: de.hsos.bachelorarbeit.nh, Plugin's descriptor contains the wrong artifact ID: endpointscoverage-maven-plugin -> [Help 1]

Solution

  • Add this to your pom:

    <pluginRepositories>
        <pluginRepository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </pluginRepository>
    </pluginRepositories>
    

    Because you are using a plugin. Your code with <repositories> covers only the dependencies, not the plugin dependencies.

    Keep the rest as it is and run mvn dependency:resolve-plugins command to resolve you plugin dependencies.


    Here is my working pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>Sandbox</groupId>
        <artifactId>Sandbox</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    
        <repositories>
            <repository>
                <id>jitpack.io</id>
                <url>https://jitpack.io</url>
            </repository>
        </repositories>
    
        <pluginRepositories>
            <pluginRepository>
                <id>jitpack.io</id>
                <url>https://jitpack.io</url>
            </pluginRepository>
        </pluginRepositories>
    
        <build>
            <sourceDirectory>src</sourceDirectory>
            <resources>
                <resource>
                    <directory>src</directory>
                    <excludes>
                        <exclude>**/*.java</exclude>
                    </excludes>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>com.github.NiklasHoltmeyer</groupId>
                    <artifactId>maven-endpointscoverage</artifactId>
                    <version>1.0.0</version>
                </plugin>
            </plugins>
        </build>
    </project>