我使用命令:mvn 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>但是由于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',它失败了
此异常发生在windows 10上,但在centos 7上是可以的。
希望有人能帮我解决这个问题
发布于 2019-11-22 03:33:23
试着使用
mvn清洁包装
或
mvn清洁安装
使用clean与软件包或安装一起将清除目标目录,因此相同的jar不会在目标位置重叠。
包将编译您的代码并将其打包。例如,如果您的pom说该项目是一个jar,那么当您将其打包并放置在目标目录中(默认情况下)时,它将为您创建一个jar。
安装将编译和打包,但它也会将包放在本地存储库中。这样,其他项目就可以引用它,并从您的本地存储库获取它。
发布于 2021-05-05 12:17:44
我用目标文件夹打开了case cmd
https://stackoverflow.com/questions/58987074
复制相似问题