更多信息请从官网获取https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE

1.parent基于自己项目而非spring-boot-starter-parent

  目前解决方案

    (1)所有的springboot依赖显示写出版本号

    (2)plugin显示写出执行目标repackage

 <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.0.1.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.1.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.0.1.RELEASE</version>
<scope>test</scope>
</dependency> <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.1.RELEASE</version>
<configuration>
<classifier>exec</classifier>
<executable>true</executable>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

note: <classifier>exec</classifier>该标签作用是如果有其他项目依赖该项目时,会打成两个jar,一个是xxx.jar(别的项目依赖用)另一个是xxx-exec.jar(部署执行用)

2.idea run没问题,打成jar包执行报资源文件找不到

  目前解决方案是拷贝一份资源文件到classes目录下即可

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration> </execution>
</executions>
</plugin>

如果idea run也报资源文件找不到

  (1)检查该文件是否存在resources文件夹内

(2)检查resources文件夹是否为Resources Root 。否则右键Mark Directory As --> Resources Root 即可



springboot maven的更多相关文章

  1. springboot+maven整合spring security

    springboot+maven整合spring security已经做了两次了,然而还是不太熟悉,这里针对后台简单记录一下需要做哪些事情,具体的步骤怎么操作网上都有,不再赘述.1.pom.xml中添 ...

  2. springboot maven项目,为什么build成功,build path也没错误,project-->clean 也没用,项目上面还是有个红x呢?

    springboot maven项目,为什么build成功,build path也没错误,project-->clean 也没用,项目上面还是有个红x呢? 看错误信息有提示:  Descript ...

  3. SpringBoot+Maven 多模块项目的构建、运行、打包

    SpringBoot+Maven 多模块项目的构建.运行.打包 https://blog.csdn.net/zekeTao/article/details/79413919

  4. java springboot+maven发送邮件

    springboot+maven发送邮件 废话不多说直接上代码 1. pom 文件导入jar包 <!--邮件发送--> <dependency> <groupId> ...

  5. 工具IDEA 配置springboot+maven项目

    工具IDEA 配置springboot+maven项目 首先安装IDEA,至于怎么安装就不介绍了.. 第一步 配置maven环境 首先安装maven,先在网上下载一个maven包.在IDEA的sett ...

  6. springboot+maven——打war包方式

    转载 Springboot打包war包部署到自己的tomcat中 一.springboot+maven工程——打war包步骤如下: 1.修改父pom.xml文件: <packaging>p ...

  7. 转 使用Docker部署 spring-boot maven应用

    转自:https://blog.csdn.net/u011699931/article/details/70226504/ 使用Docker部署 spring-boot maven应用 部署过程分为以 ...

  8. IDEA + SpringBoot + maven 项目文件说明

    Springboot + maven + IDEA + git 项目文件介绍 1..gitignore  分布式版本控制系统git的配置文件,意思为忽略提交 在 .gitingore 文件中,遵循相应 ...

  9. springboot maven打包插件

    <build> <plugins> <!-- springboot maven打包--> <plugin> <groupId>org.spr ...

  10. springboot maven项目运行常见报错 及ajax请求报错

    如图所示 tomcat运行后直接停止,也不报错 原因:我的原因是controller路径配置重名或者service没有配置@Service 遇见这错找了好久问题,网上也搜不到,特此记录一下 问题2 a ...

随机推荐

  1. C语言学习记录_2019.02.10

    sizeof:给出某个类型或某个变量在内存中占据的字节数:(1个字节8位,即8比特) 格式符 (1)%ld表示数据按十进制有符号长型整数输入或输出. (2)%d表示数据按十进制有符号整型数输入或输出. ...

  2. 乘积尾零——第九届蓝桥杯C语言B组(省赛)第三题

    原创 标题:乘积尾零 如下的10行数据,每行有10个整数,请你求出它们的乘积的末尾有多少个零? 5650 4542 3554 473 946 4114 3871 9073 90 4329 2758 7 ...

  3. 【转】WCF设置拦截器捕捉到request和reply消息

    原文:https://www.cnblogs.com/yanglang/p/7063743.html 我们需要拦截消息,并把消息打印出来,那么我们就需要一个拦截器,叫做MessageInspector ...

  4. mysql存储过程批量插入数据

    DROP TABLE IF EXISTS TeachersInfo; CREATE TABLE TeachersInfo ( id INT NOT NULL AUTO_INCREMENT, teach ...

  5. 20145234黄斐《网络对抗技术》实验八、Web基础

    Apache 先通过apachectl start命令开启Apach,使用netstat -aptn命令查看端口占用: 因为端口号80已经被占用(上次实验设置的),所以先修改/etc/apache2/ ...

  6. WPF Expander获得ToggleButton

    原文:WPF Expander获得ToggleButton ToggleButton m_ToggleButton = this.Template.FindName("HeaderSite& ...

  7. jQuery学习-属性选择器

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. [APIO2018] Duathlon 铁人两项 圆方树,DP

    [APIO2018] Duathlon 铁人两项 LG传送门 圆方树+简单DP. 不会圆方树的话可以看看我的另一篇文章. 考虑暴力怎么写,枚举两个点,答案加上两个点之间的点的个数. 看到题面中的一句话 ...

  9. Core - Provide an easy way to store administrator and user model differences in a custom store (e.g., in a database)

    https://www.devexpress.com/Support/Center/Question/Details/S32444/core-provide-an-easy-way-to-store- ...

  10. vs2012调试时,抛出异常的等待时间很慢,原来是QQ电脑管家搞的鬼。

    vs2012调试时,抛出异常的等待时间以前都正常,不知什么时候起变得很慢,就是出错以后要等30秒以上才会提示,一直找不到原因. 今天看了一下任务管理器,发现有个QQpcrTP进程(好像是,因为卸载了) ...