简体   繁体   中英

maven release plugin fail

When I try to do:

> maven release:prepare

I get an error:

release:prepare error

I tried to change mvn.cmd to mvn.bat but that did not help:

" Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project sfg-pet-clinic: Failed to invoke Maven build. Error configuring command-line. Reason: Maven executable not found at: C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.1\plugins\maven\lib\maven3\bin\mvn.bat"

Below is a trace of my maven build

> "C:\Program Files\Java\jdk1.8.0_181\bin\java.exe"
> -Dmaven.multiModuleProjectDirectory=C:\Users\Charles\Desktop\kurs\sfg-pet-clinic
> "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA
> 2018.1.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA
> 2018.1.1\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA
> 2018.1.1\lib\idea_rt.jar=64828:C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program
> Files\JetBrains\IntelliJ IDEA
> 2018.1.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2018.1.1
> org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare -f pom.xml
> 
> [INFO] Scanning for projects...
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO] Reactor Build Order:
> 
> [INFO]
> 
> [INFO] sfg-pet-clinic
> 
> [INFO] pet-clinic-data
> 
> [INFO] pet-clinic-web
> 
> [INFO]                                                                
> 
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO] Building sfg-pet-clinic 0.0.1
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO]
> 
> [INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @
> sfg-pet-clinic ---
> 
> [INFO] Resuming release from phase 'run-preparation-goals'
> 
> [INFO] Executing goals 'clean verify'...
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO] Reactor Summary:
> 
> [INFO]
> 
> [INFO] sfg-pet-clinic ..................................... FAILURE [ 
> 2.356 s]
> 
> [INFO] pet-clinic-data .................................... SKIPPED
> 
> [INFO] pet-clinic-web ..................................... SKIPPED
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO] BUILD FAILURE
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [INFO] Total time: 3.110 s
> 
> [INFO] Finished at: 2018-09-18T13:51:01+02:00
> 
> [INFO] Final Memory: 17M/228M
> 
> [INFO]
> ------------------------------------------------------------------------
> 
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare
> (default-cli) on project sfg-pet-clinic: Failed to invoke Maven build.
> Error configuring command-line. Reason: Maven executable not found at:
> C:\Program Files\JetBrains\IntelliJ IDEA
> 2018.1.1\plugins\maven\lib\maven3\bin\mvn.bat -> [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/MojoExecutionException
> 
> 
> 
> Process finished with exit code 1

POM

    <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>guru.springframework</groupId>
    <artifactId>sfg-pet-clinic</artifactId>
    <version>0.0.1</version>
    <modules>
        <module>pet-clinic-data</module>
        <module>pet-clinic-web</module>
    </modules>
    <packaging>pom</packaging>

    <name>sfg-pet-clinic</name>
    <description>SFG Pet Clinic Project</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <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>
                    <goals>install</goals>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

after maven can be found on command line I've tried execution from terminal and still I've got a failure

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project sfg-pet-clinic: U
nable to tag SCM
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] Host key verification failed.
[ERROR] fatal: Could not read from remote repository.
[ERROR]
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]

    enter code here

I know it is a very old question, but I had the same issue.

I have restricted access to my machine, so I cannot do everything using cmd , Powershell, or a Bash-terminal. So I had to make it work using IntelliJ.

Just to highlight, I agree to all those good comments: prefer using the installed mvn terminal, locally test release/versions:updates etc.

But, the answer to your question is hidden in yourdebug log.日志。

> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare
> (default-cli) on project sfg-pet-clinic: Failed to invoke Maven build.
> Error configuring command-line. Reason: Maven executable not found at:
> C:\Program Files\JetBrains\IntelliJ IDEA
> 2018.1.1\plugins\maven\lib\maven3\bin\mvn.bat 

On a Windows machine, IntelliJ creates an executable mvn.cmd . So just create a of that mvn.cmd and save it as mvn.bat or mvn.cmd to mvn.bat .并将其保存为mvn.batmvn.cmdmvn.bat

Although this will run your Maven release plugin, you still have to set scm tag.

I'm actually doing the same project as you (Spring Framework Guru), and probably the same course. I had the same issue when I was trying to run the mvn release:prepare from Eclipse. However I also have a newer version of maven installed and configured on my PC (with the environment variable set). So I tried to run manually mvn release:prepare from Command Prompt Windows and worked perfectly. Apparently Maven in Eclipse is using an older version which, hasn't fixed this bug yet.

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