[英]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.