首页 > 解决方案 > Jenkins Maven 插件错误“maven-release-plugin:jar:3.8.2 is missing”

问题描述

我是新人,但我浏览了许多帖子和网站,最后发布了,因为我不知道还能做什么。如果格式或我发布的方式不正确,请原谅。正如我所说,第一次来这里。如果我直接运行mvn clean package deploy构建成功。但是当我从詹金斯运行构建时失败。

尝试运行构建时,我在 Jenkins 中收到以下错误

Downloaded from central: http://localhost:8081/artifactory/first-libs-release/org/apache/maven/plugins/maven-release-plugin/2.5.3/maven-release-plugin-2.5.3.jar (53 kB at 3.5 MB/s)
[WARNING] The POM for org.apache.maven.plugins:maven-release-plugin:jar:3.8.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.785 s
[INFO] Finished at: 2021-09-20T21:12:36+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-release-plugin:3.8.2 or one of its dependencies could not be resolved: org.apache.maven.plugins:maven-release-plugin:jar:3.8.2 was not found in http://localhost:8081/artifactory/first-libs-release during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Build step 'Conditional steps (multiple)' marked build as failure
Finished: FAILURE

我的 pom.xml 下面:

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>devops</artifactId>
    <version>0.1.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>devops</name>
    <description>DevOps demo project</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        
        <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <optional>true</optional>
            </dependency>

            <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

<distributionManagement>
    <repository>
        <id>central</id>
        <name>first-libs-release</name>
        <url>http://localhost:8081/artifactory/first-libs-release</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>first-libs-snapshot</name>
        <url>http://localhost:8081/artifactory/first-libs-snapshot</url>
    </snapshotRepository>
</distributionManagement>

<scm>
    <connection>scm:git:git@github.com:rahul-9911/devops.git</connection>
    <developerConnection>scm:git:git@github.com:rahul-9911/devops.git</developerConnection>
    <url>git@github.com:rahul-9911/devops.git</url>
    <tag>HEAD</tag>
</scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.8.2</version>
            <configuration>
                <tagNameFormat>v@{project.version}</tagNameFormat>
                <autoVersionSubmodules>true</autoVersionSubmodules>
            </configuration>
            </plugin>
        </plugins>
    </build>

</project>




标签: javamavenjenkinsdependencies

解决方案


好的,终于找到问题了。maven-release-version 不正确。已经知道@khmarbaise 指出的那样,但是哪个?

经过一天的挣扎,我意识到被拉取的是 GIT 上的 pom.xml。这个有错误的版本3.8.2

所以我更正了 GIT 上的 POM.XML 并更正了发布版本。

终于成功了!!


推荐阅读