简体   繁体   English

maven 发布插件失败

[英]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:我试图将mvn.cmd更改为mvn.bat但这没有帮助:

" 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下面是我的 Maven 构建的痕迹

> "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在命令行上可以找到 maven 后,我尝试从终端执行,但仍然失败

[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.我限制了对我的机器的访问,所以我不能使用cmd 、Powershell 或 Bash 终端做任何事情。 So I had to make it work using IntelliJ.所以我不得不使用 IntelliJ 让它工作。

Just to highlight, I agree to all those good comments: prefer using the installed mvn terminal, locally test release/versions:updates etc.只是强调一下,我同意所有这些好评:更喜欢使用已安装的mvn终端、本地测试版本/版本:更新等。

But, the answer to your question is hidden in your但是,你的问题的答案隐藏在你的debug调试error 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 .在 Windows 机器上,IntelliJ 创建一个可执行文件mvn.cmd So just create a copy of that mvn.cmd and save it as mvn.bat or rename mvn.cmd to mvn.bat .因此,只需创建该mvn.cmd副本并将其保存为mvn.batmvn.cmd重命名mvn.bat

Although this will run your Maven release plugin, you still have to set scm tag.虽然这将运行您的 Maven 发布插件,但您仍然需要设置scm标签。

I'm actually doing the same project as you (Spring Framework Guru), and probably the same course.我实际上和你在做同样的项目(Spring Framework Guru),而且可能是同样的课程。 I had the same issue when I was trying to run the mvn release:prepare from Eclipse.当我尝试从 Eclipse 运行mvn release:prepare时遇到了同样的问题。 However I also have a newer version of maven installed and configured on my PC (with the environment variable set).但是,我的 PC 上还安装并配置了较新版本的 maven(设置了环境变量)。 So I tried to run manually mvn release:prepare from Command Prompt Windows and worked perfectly.所以我尝试从命令提示符 Windows 手动运行mvn release:prepare并且运行良好。 Apparently Maven in Eclipse is using an older version which, hasn't fixed this bug yet.显然 Eclipse 中的 Maven 使用的是旧版本,尚未修复此错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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