Spring Boot Maven 打包可执行Jar文件
本文转载自:http://blog.csdn.net/smilecall/article/details/56288972
Maven pom.xml 必须包含
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
完整pox.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> <groupId>com.feedback</groupId>
<artifactId>feedback-service</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging> <properties>
<java.version>1.8</java.version>
</properties> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
</parent> <dependencies>
<!-- spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> <!-- mysql数据库 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency> <!-- commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies> <!-- jar -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
进入到项目目录下运行:mvn clean package

会在项目目录下target文件夹中生成jar
如上生成的jar文件在:D:\programmer\eclipse\feedback-service\target 文件夹中
Java -jar 运行jar包 即可

java -jar 运行jar包时使用外部配置文件application.properties


Spring Boot Maven 打包可执行Jar文件的更多相关文章
- Spring Boot Maven 打包可执行Jar文件!
Maven pom.xml 必须包含 <packaging>jar</packaging> <build> <plugins> <plugin&g ...
- Spring Boot Gradle 打包可执行Jar文件!
使用Gradle构建项目,继承了Ant的灵活和Maven的生命周期管理,不再使用XML作为配置文件格式,采用了DSL格式,使得脚本更加简洁. 构建环境: jdk1.6以上,此处使用1.8 Gradle ...
- maven打包可执行jar文件运行报错
起因 项目中同时依赖了Spring和MyBatis,并使用mybatis-spring集成MyBatis和Spring. 使用maven打包为可执行jar文件运行,打包插件为:maven-shade- ...
- spring boot maven打包可运行jar包
普通打包之后在程序目录运行,或者编写bat运行时会提示“没有主清单属性”,这是因为并没有找到main()方法,需要我们指明告诉java程序 我bat中的代码 @echo off title mytit ...
- spring boot项目maven打包可执行JAR
在pom.xml中添加如下配置: <!-- 打包可执行jar包 --> <plugin> <groupId>org.springframework.boot< ...
- 将 Spring boot 项目打成可执行Jar包,及相关注意事项(main-class、缺少 xsd、重复打包依赖)
最近在看 spring boot 的东西,觉得很方便,很好用.对于一个简单的REST服务,都不要自己部署Tomcat了,直接在 IDE 里 run 一个包含 main 函数的主类就可以了. 但是,转念 ...
- Apache Maven 打包可执行jar
在本文的 参考资料 部分,您将发现大量介绍 Maven 的入门教程.本文的 5 个技巧目的是帮助您解决即将出现的一些问题:使用 Maven 管理您的应用程序的生命周期时,将会出现的编程场景. 1. 可 ...
- Spring Boot Maven 打包 Jar
Maven pom.xml 必须包含 <packaging>jar</packaging> <build> <plugins> <plugin&g ...
- Spring boot 项目导出可执行jar
配置文件中添加插件 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>s ...
随机推荐
- asp.net连接MySQL数据库错误-Out of sync with server
问题 网上说:http://wenda.haosou.com/q/1386389928069965 昨晚这个问题真的费了我不少时间(晚上9到凌晨2点),网上找解决方案,然后一个个尝试,没有成功.准备放 ...
- poj 2739 Sum of Consecutive Prime Numbers 素数 读题 难度:0
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19697 ...
- log4j打印不同颜色
1.首先在eclipse中安装一个插件: ANSI COLOR 在Eclipse Marketplace 中直接搜索 ANSI COLOR 然后安装 2.在log4j 中加入红色字体部分: < ...
- QT中Qtableview视图表格中点击表头进行排序
用QT写了一个小工具,主要是对Excel中大量的数据进行计算和显示. 写了有一段时间,然后断断续续的做一些修改和完善. 因为要显示的数据有多列,很自然的会想到要能够对显示的数据进行排序.如果直接操作m ...
- LeetCode OJ:Maximal Square(最大矩形)
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and ret ...
- asp下去除数组中重复的项的方法
<%Function MoveR(Rstr) Dim i,SpStr SpStr = Split(Rstr,",") For i = 0 To Ubound(Spstr) I ...
- WiFi无线网络参数 802.11a/b/g/n 详解
转载自:WiFi无线网络参数 802.11a/b/g/n 详解 如转载侵犯您的版权,请联系:2378264731@qq.com 802.11a/b/g/n,其实指的是无线网络协议,细分为802.11a ...
- 20165202 week10课下补做
相关知识点总结 在数据结构和算法中,排序是很重要的操作,要让一个类可以进行排序,有两种方法: 有类的源代码,针对某一成员变量排序,让类实现Comparable接口,调用Collection.sort( ...
- Freemaker的java.beans.IntrospectionException: type mismatch between read and write methods
引言:freemaker在特定的spring以及jdk下的问题解决路径. 环境描述 spring 3.1.1, jdk1.8u80, freemake 2.3.19 错误信息描述: 严重: Excep ...
- EasyDSS RTMP流媒体服务器videojs flash播放RTMP/HLS提示错误的解决方案
本文转自EasyDSS团队成员StarIT的博客:http://blog.csdn.net/staritstarit/article/details/73692715 问题 在博客<EasyDS ...