0

我想使用 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
  • 掌握
  • 主-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]
4

1 回答 1

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>
于 2018-12-02T12:54:33.460 回答