JitPack Maven PluginResolutionException

时间:2018-12-02 12:40:29

标签: java maven jitpack

我想使用 https://github.com/NiklasHoltmeyer/maven-endpointscoverage

无需克隆它:

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]

如果我编译该插件,并根据Commentblock内部的所有内容更改groupId / artifactId,则它起作用。.

我还尝试了以下版本:

  • 1.0.0
  • 主人
  • master-f2d0242df8-1
  • 主快照
  • -快照
  • 发布
  • 最新

如果有人可以帮助我,那就太好了

编辑:

新的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]

1 个答案:

答案 0 :(得分:1)

将此添加到您的pom:

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

因为您使用的是插件。您的带有<repositories>的代码仅包含依赖关系,而不包含插件依赖关系。

将其余部分保持原样,然后运行mvn dependency:resolve-plugins命令来解决您的插件依赖性。


这是我的工作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>