Spring Boot Maven 打包 Jar
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
linux下执行jar
- nohup java -Xmx512M -Xms512M -Djava.security.egd=/dev/urandom -jar message-service-1.0-SNAPSHOT.jar > /dev/null 2>&1 &
Spring Boot Maven 打包 Jar的更多相关文章
- spring boot maven打包可运行jar包
普通打包之后在程序目录运行,或者编写bat运行时会提示“没有主清单属性”,这是因为并没有找到main()方法,需要我们指明告诉java程序 我bat中的代码 @echo off title mytit ...
- Spring Boot Maven 打包可执行Jar文件!
Maven pom.xml 必须包含 <packaging>jar</packaging> <build> <plugins> <plugin&g ...
- Spring Boot Maven 打包可执行Jar文件
本文转载自:http://blog.csdn.net/smilecall/article/details/56288972 Maven pom.xml 必须包含 <packaging>ja ...
- Spring Boot Maven Plugin打包异常及三种解决方法:Unable to find main class
[背景]spring-boot项目,打包成可执行jar,项目内有两个带有main方法的类并且都使用了@SpringBootApplication注解(或者另一种情形:你有两个main方法并且所在类都没 ...
- Gradle 如何打包 Spring Boot 可执行 JAR
如何在 Gradle 中配置一个项目可以打包为 Spring Boot 可执行 Jar? 你首先需要添加到 org.springframework.boot 到插件中: 例如下面的代码: plugin ...
- Spring Boot Maven Plugin(二):run目标
简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...
- Spring Boot Maven Plugin(一):repackage目标
简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...
- Spring boot 应用打包部署
1.Spring Boot内置web spring Boot 其默认是集成web容器的,启动方式由像普通Java程序一样,main函数入口启动.其内置Tomcat容器或Jetty容器,具体由配置来决定 ...
- 微服务下 Spring Boot Maven 工程依赖关系管理
单体 Spring Boot Maven 工程 最基本的 pom.xml 包含工程信息.Spring Boot 父工程.属性配置.依赖包.构建插件 <?xml version="1.0 ...
随机推荐
- 关于QT编译错误问题
这里的意思是出现QT编译错误: 1.之前编译没问题,突然就报错了,而且错误根本不知道啥玩意. 2.编译出现不能自动更新,比如更改ui但是编译之后没该改变. ... 解决方法: 1.删除Makefile ...
- android TextView 例子代码(文字图片、文字省略、文字滚动)
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- [UGUI]帧动画
ImageFrameAnimation.cs using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [R ...
- js-杂记
js可计算传值 <p>点击按钮计算 x 的值.</p> <button onclick="myFunction()">点击这里</butt ...
- 1.App爬取相关库的安装(安装Charles及手机端证书安装配置)
一.官网下载Charles安装包: https://www.charlesproxy.com/download1.下载对应版本 我这里下载的是 win 64 bit (下载完解压,双击打开charle ...
- ubuntu 上 SSH scp 技巧
参考:https://deepzz.com/post/how-to-setup-ssh-config.html SSH(Secure Shell)是什么?是一项创建在应用层和传输层基础上的安全协议,为 ...
- java环境变量配置方法
原创文章,转载请注明出处. 这是本人2011-9-4记录的,现在把它放在博客上. windows xp下配置JDK环境变量: 1.安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为 ...
- Java安全编码标准
Java安全编码标准 具体参考Rules 输入验证和数据净化(IDS)规则风险评估概要 IDS00-J净化穿越受信边界的非受信数据 IDS01-J验证前标准化字符串 IDS02-J在验证之前标准化路径 ...
- Mysql索引,有哪几种索引,什么时候该(不该)建索引;SQL怎么进行优化以及SQL关键字的执行顺序
索引(Index)是帮助MySQL高效获取数据的数据结构.提取句子主干,就可以得到索引的本质:索引是数据结构. 1.按照索引列值的唯一性,索引可分为唯一索引和非唯一索引 非唯一索引:B树索引 crea ...
- Jsoup解析网页源码时常用的Element(s)类
Jsoup解析网页源码时常用的Element(s)类 一.简介 该类是Node的直接子类,同样实现了可克隆接口.类声明:public class Element extends Node 它表示由一个 ...