简体   繁体   English

spring-boot-maven-plugin:2.0.0.RELEASE:repackage 失败:无法重命名

[英]spring-boot-maven-plugin:2.0.0.RELEASE:repackage failed: Unable to rename

I use command: mvn package to package my project, and the pom.xml as follows:我使用命令: mvn package到 package 我的项目,以及 pom.xml 如下:

<build>
        <defaultGoal>compile</defaultGoal>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass/>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

but it's faild because of Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:repackage failed: Unable to rename 'D:\Code\analysis\server\target\access_server-2.0.0.RELEASE.jar' to ' D:\Code\nalysis\server\target\access_server-2.0.0.RELEASE.jar.original'但由于Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:repackage failed: Unable to rename 'D:\Code\analysis\server\target\access_server-2.0.0.RELEASE.jar' to ' D:\Code\nalysis\server\target\access_server-2.0.0.RELEASE.jar.original'

this exception occurs on windows 10, but it's ok on centos 7.此异常发生在 windows 10 上,但在 centos 7 上没问题。

counld any one help me solve this problem谁能帮我解决这个问题

Try using尝试使用

mvn clean package mvn clean package

or或者

mvn clean install mvn 干净安装

Using clean along with package or install will clear the target directory so the same jar won't overlap at the destination.使用 clean 和 package 或 install 将清除目标目录,因此相同的 jar 不会在目标位置重叠。

package will compile your code and also package it. package 将编译您的代码以及 package 它。 For example, if your pom says the project is a jar, it will create a jar for you when you package it and put it somewhere in the target directory (by default).例如,如果你的 pom 说项目是 jar,它会在你 package 时为你创建一个 jar 并将其放在目标目录中的某个位置(默认)。

install will compile and package, but it will also put the package in your local repository. install 将编译 package,但它也会将 package 放入本地存储库中。 This will make it so other projects can refer to it and grab it from your local repository.这将使其他项目可以引用它并从您的本地存储库中获取它。

I my case cmd was open with target folder我的案例 cmd 使用目标文件夹打开

暂无
暂无

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

相关问题 目标org.springframework.boot的执行默认值:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to rename - Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to rename spring-boot-maven-plugin 重新打包执行默认失败 - execution default of spring-boot-maven-plugin repackage failed Spring Boot应用程序启动失败并显示2.0.0.RELEASE - Spring Boot application start failed with 2.0.0.RELEASE 目标org.springframework.boot的执行默认值:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed:Source必须引用现有文件 - Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: Source must refer to an existing file 目标的执行默认值 org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage failed: Source must refer to an existing file - Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage failed: Source must refer to an existing file 无法在插件org.springframework.boot中找到目标:&#39;spring-boot-maven-plugin:1.1.4.RELEASE可用目标重新打包 - Could not find goal '' in plugin org.springframework.boot:spring-boot-maven-plugin:1.1.4.RELEASE among available goals repackage 执行目标 org.springframework.boot:spring-boot-maven-plugin:2.4.4:repackage 的 default-cli 失败:无法找到主 class - Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.4.4:repackage failed: Unable to find main class 无法在 spring-boot-maven-plugin 中分叉 - Unable to fork in spring-boot-maven-plugin 使用nar-maven-plugin的Spring-boot-maven-plugin重新打包目标错误 - Spring-boot-maven-plugin repackage goal error using nar-maven-plugin spring-boot 执行 org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage 时缺少必需的类 - spring-boot A required class was missing while executing org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM