Maven发布插件失败

时间:2018-09-18 12:19:12

标签: maven intellij-idea maven-3 maven-plugin

当我尝试做时:

> maven release:prepare

我得到一个错误:

release:prepare error

我尝试将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"

以下是我的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>

在命令行上可以找到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

2 个答案:

答案 0 :(得分:0)

我实际上正在与您(Spring Framework Guru)执行相同的项目,并且可能正在执行相同的课程。 尝试从Eclipse运行mvn release:prepare时遇到了相同的问题。但是,我还在PC上安装并配置了较新版本的maven(已设置了环境变量)。因此,我尝试从Command Prompt Windows手动运行mvn release:prepare,并且运行良好。 显然,Eclipse中的Maven使用的是较旧的版本,尚未修复此错误。

答案 1 :(得分:0)

我知道这是一个非常老的问题,但是我遇到了同样的问题。

我限制了对计算机的访问,因此无法使用cmd,Powershell或Bash终端来执行所有操作。因此,我不得不使用IntelliJ使其工作。

仅强调一下,我同意所有这些好的评论:宁愿使用已安装的mvn终端,本地测试发行版/版本:更新等。

但是,问题的答案隐藏在调试 错误日志中。

> [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 

在Windows计算机上,IntelliJ创建可执行文件mvn.cmd。因此,只需创建该mvn.cmd副本并将其另存为mvn.bat重命名 mvn.cmdmvn.bat。 / p>

尽管这将运行您的Maven发布插件,但您仍然必须设置scm标签。