Spring Boot执行repackage打包与Source must refer to an existing file异常解决
来源:互联网 发布:pdf阅读器下载 知乎 编辑:程序博客网 时间:2024/06/11 08:59
在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启动的,不需要另外配置一个Web Server。单独的JAR包,然后通过java -jar <name>.jar
命令运行。
pom配置:
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments> <mainClass>com.research.contactsrepairing.repairCalculate.ExtractApp</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions></plugin>
直接运行idea的repackage会报错(Source must refer to an existing file异常)
分析异常:
spring-boot:repackage在执行过程中,首先读取已经打包的jar文件,然后进行必要的启动设置,并最终输出可执行的jar文件。
这里的异常明显是没有能够读取到mvn package打包的jar文件。
尝试重新执行mvn package spring-boot:repackage,成功。
由于spring-boot:repackage是Spring Boot Maven Plugin的默认goal,所以再次尝试mvn package,发现同样输出了可执行的jar文件。
解决方案:
为了重新打包得到Spring Boot可执行的jar文件,
永远避免直接执行mvn spring-boot:repackage。
必要时,执行mvn package spring-boot:repackage;或者干脆mvn package。
阅读全文
0 0
- Spring Boot执行repackage打包与Source must refer to an existing file异常解决
- Spring Boot执行repackage遇到Source must refer to an existing file异常详解
- Caused by: java.lang.IllegalArgumentException: The handle attribute is must refer to an existing chi
- Value must be an existing directory 解决
- To create an .edmx file from an existing database
- Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.2.RELEASE:repackage (de
- Spring Boot Maven Plugin -- repackage目标
- Spring Boot Maven Plugin -- repackage鐩?爣
- Spring Boot Maven Plugin -- repackage鐩?爣
- SlidingDrawer引发java.lang.IllegalArgumentException: The content attribute is must refer to an existin
- error : A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be ext
- Spring boot JSP 打包执行问题
- Spring中使用proxool连接池的配置方式与出现Attempt to refer to a unregistered pool by its alias 'ums'异常的解决办法
- Must use 'struct' tag to refer to type 'tagCommonUserInfo'
- Cannot refer to a non-final variable file inside an inner class defined in a different method
- Value must be an existing directory配置tomcat问题?
- Value must be an existing directory配置tomcat问题
- Adding React to an Existing Application
- HDU 1695 GCD
- Ruby元编程-学习笔记(四)-类定义
- 董的博客
- Android5.0 WebView中Http和Https混合问题
- 事件驱动模型概述
- Spring Boot执行repackage打包与Source must refer to an existing file异常解决
- Error:java: 无效的目标发行版: 1.8
- LayoutInflater源码分析
- Centos6.5安装docker
- 简谈JAVA基础--IO流
- nginx学习随笔--pid
- jsp简介和el标签 jstl标签
- python安装numpy、scripy失败总结
- 树状数组求逆序数