目标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
问题描述
我想使用maven-jar-plugin来构建diff分类器jar,例如:
i want to use maven-jar-plugin to build diff classifier jars,like :
mvn deploy:deploy -P debug,classifier-demo-0.0.1 -debug.jar已部署
mvn deploy:deploy -P debug , classifier-demo-0.0.1-debug.jar deployed
mvn deploy:deploy -P test,classifier-demo-0.0.1-test.jar已部署。
mvn deploy:deploy -P test , classifier-demo-0.0.1-test.jar deployed.
但失败:
Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: Source must refer to an existing file
pom.xml:
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
<groupId>org.lenic</groupId>
<artifactId>classifier-demo</artifactId>
<version>0.0.1</version>
<properties>
<java.version>1.7</java.version>
</properties>
<distributionManagement>
<repository>
<id>local-repo</id>
<url>file://D:\repo</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>test</id>
<properties>
<classifier>test</classifier>
</properties>
</profile>
<profile>
<id>debug</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<classifier>debug</classifier>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classifier>${classifier}</classifier>
</configuration>
</plugin>
</plugins>
</build>
推荐答案
目标:重新包装
重新包装尝试重新打包原始工件,即projectName.jar。这是maven的默认包阶段的结果,即 mvn package 命令输出。
Goal: Repackage Repackage tries to repackage original artifact i.e projectName.jar. Which is outcome of default package phase of maven i.e mvn package command output.
当Repackage目标执行时,它尝试查找projectName.jar。
When Repackage goal executes it tries to find projectName.jar.
当你运行mvn spring-boot:package时,projectName.jar不在那里。
表示错误的原因来源必须引用现有文件
When you run mvn spring-boot:package at that time projectName.jar is not there. that why it gives error Source must refer to an existing file
解决方案:
run command
mvn clean package spring-boot:repackage
Solution: run command mvn clean package spring-boot:repackage
这篇关于目标org.springframework.boot的执行默认值:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed:Source必须引用现有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!