简体   繁体   中英

Problem with maven release:prepare for Spring Boot 2.3.1.RELEASE

I have a project with the following parent:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.1.RELEASE</version>
    </parent>

and the following plugins:

    <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>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <releaseProfiles>release</releaseProfiles>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-scm-plugin</artifactId>
                        <version>1.8.1</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

When I try to make mvn -DpreparationGoals=clean release:prepare it fails with this message:

[INFO] Executing: /bin/sh -c cd /root/.jenkins/workspace/Eureka-Client_Pipeline_develop && git push ssh://will:*******@github.com/spring-projects/spring-boot.git/PGXperts-Eureka-Client develop:develop
[INFO] Working directory: /root/.jenkins/workspace/Eureka-Client_Pipeline_develop
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.459s
[INFO] Finished at: Tue Jul 07 14:34:14 CEST 2020
[INFO] Final Memory: 16M/536M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project PGXperts-Eureka-Client: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
[ERROR] Host key verification failed.
[ERROR] fatal: Could not read from remote repository.

For the first line of the Error message I can notice that it is trying to make a push to github and not to my git repository, this step was working without problems when I was working with spring-boot-starter-parent 2.2.7.RELEASE . I think maybe the problem can be solved updating the version of the plugins, but I tested with versions 3.0.0-M1 for maven-release-plugin and 1.11.2 for maven-scm-plugin and I get the same error. Is this error because of this versions? If yes, which versions should I choose? It is maybe a bug from spring-boot-starter-parent?

There's a small regression in Spring Boot 2.3.0 and 2.3.1 that means that your project will be inheriting more from spring-boot-starter-parent than it should. This includes information about the project's source code management (SCM) which I suspect is why the push is being made to the wrong place.

The Spring Boot reference documentation shows the elements that you should override to avoid inheriting them. If you are using Spring Boot 2.3.1 or 2.3.0, there are some additional overrides that need to be made. These additions leave the complete set looking like the following:

<description/>
<url/>
<organization/>
<issueManagement/>
<developers>
    <developer/>
</developers>
<licenses>
    <license/>
</licenses>
<scm>
    <connection/>
    <developerConnection/>
    <url/>
</scm>

Adding the above, or upgrading to Spring Boot 2.3.2 when it is released, should restore Spring Boot 2.2's behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM