Maven pom.xml 必须包含

  1. <packaging>jar</packaging>
  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.springframework.boot</groupId>
  5. <artifactId>spring-boot-maven-plugin</artifactId>
  6. <configuration>
  7. <fork>true</fork>
  8. </configuration>
  9. </plugin>
  10. </plugins>
  11. </build>

完整pox.xml

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>com.feedback</groupId>
  5. <artifactId>feedback-service</artifactId>
  6. <version>0.1.0</version>
  7. <packaging>jar</packaging>
  8. <properties>
  9. <java.version>1.8</java.version>
  10. </properties>
  11. <parent>
  12. <groupId>org.springframework.boot</groupId>
  13. <artifactId>spring-boot-starter-parent</artifactId>
  14. <version>1.3.0.RELEASE</version>
  15. </parent>
  16. <dependencies>
  17. <!-- spring boot -->
  18. <dependency>
  19. <groupId>org.springframework.boot</groupId>
  20. <artifactId>spring-boot-starter-web</artifactId>
  21. </dependency>
  22. <dependency>
  23. <groupId>org.springframework.boot</groupId>
  24. <artifactId>spring-boot-starter-data-jpa</artifactId>
  25. </dependency>
  26. <!-- mysql数据库 -->
  27. <dependency>
  28. <groupId>mysql</groupId>
  29. <artifactId>mysql-connector-java</artifactId>
  30. </dependency>
  31. <!-- commons-lang -->
  32. <dependency>
  33. <groupId>commons-lang</groupId>
  34. <artifactId>commons-lang</artifactId>
  35. <version>2.6</version>
  36. </dependency>
  37. </dependencies>
  38. <!-- jar -->
  39. <build>
  40. <plugins>
  41. <plugin>
  42. <groupId>org.springframework.boot</groupId>
  43. <artifactId>spring-boot-maven-plugin</artifactId>
  44. <configuration>
  45. <fork>true</fork>
  46. </configuration>
  47. </plugin>
  48. </plugins>
  49. </build>
  50. </project>

进入到项目目录下运行:mvn clean package

会在项目目录下target文件夹中生成jar

如上生成的jar文件在:D:\programmer\eclipse\feedback-service\target  文件夹中

java -jar 运行jar包 即可

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

linux下执行jar

    1. nohup java -Xmx512M -Xms512M -Djava.security.egd=/dev/urandom -jar message-service-1.0-SNAPSHOT.jar > /dev/null 2>&1 &

Spring Boot Maven 打包 Jar的更多相关文章

  1. spring boot maven打包可运行jar包

    普通打包之后在程序目录运行,或者编写bat运行时会提示“没有主清单属性”,这是因为并没有找到main()方法,需要我们指明告诉java程序 我bat中的代码 @echo off title mytit ...

  2. Spring Boot Maven 打包可执行Jar文件!

    Maven pom.xml 必须包含 <packaging>jar</packaging> <build> <plugins> <plugin&g ...

  3. Spring Boot Maven 打包可执行Jar文件

    本文转载自:http://blog.csdn.net/smilecall/article/details/56288972 Maven pom.xml 必须包含 <packaging>ja ...

  4. Spring Boot Maven Plugin打包异常及三种解决方法:Unable to find main class

    [背景]spring-boot项目,打包成可执行jar,项目内有两个带有main方法的类并且都使用了@SpringBootApplication注解(或者另一种情形:你有两个main方法并且所在类都没 ...

  5. Gradle 如何打包 Spring Boot 可执行 JAR

    如何在 Gradle 中配置一个项目可以打包为 Spring Boot 可执行 Jar? 你首先需要添加到 org.springframework.boot 到插件中: 例如下面的代码: plugin ...

  6. Spring Boot Maven Plugin(二):run目标

    简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...

  7. Spring Boot Maven Plugin(一):repackage目标

    简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...

  8. Spring boot 应用打包部署

    1.Spring Boot内置web spring Boot 其默认是集成web容器的,启动方式由像普通Java程序一样,main函数入口启动.其内置Tomcat容器或Jetty容器,具体由配置来决定 ...

  9. 微服务下 Spring Boot Maven 工程依赖关系管理

    单体 Spring Boot Maven 工程 最基本的 pom.xml 包含工程信息.Spring Boot 父工程.属性配置.依赖包.构建插件 <?xml version="1.0 ...

随机推荐

  1. Oracle Service Bus (OSB) 12c 的配置安装

    Oracle Service Bus (OSB) 12c 的配置安装 1.OSB配置环境: Oracle Database Oracle Fusion Middleware Infrastructur ...

  2. nodejs学习笔记<二> 使用node创建基础服务器

    创建服务器的 server.js 内容. var http = require("http"); // 引用http模块 http.createServer(function(re ...

  3. VS2015和QTcreator冲突解决办法

    当我安装了QT(联合VS的版本)和VS时候,刚开始几个月都是可以的,突然有一天不行了,一直显示出错(由于着急没有记录出错截图)!这个时候卸载QT和VS都没有用,两个软件连新建工程都不行了.试了网上说的 ...

  4. 了解Python内存管理机制,让你的程序飞起来

    引用: 语言的内存管理是语言设计的一个重要方面.它是决定语言性能的重要因素.无论是C语言的手工管理,还是Java的垃圾回收,都成为语言最重要的特征.这里以Python语言为例子,说明一门动态类型的.面 ...

  5. 关于thinkphp3.1无法加载模块解决办法

    关于thinkphp3.1无法加载模块解决办法 如果没有具体的哪个模块的名字 请注意PHP的版本问题

  6. 详解一个ThreadLocal 的谜题

    多线程如果不理解透彻, 那么 ThreadLocal 始终是有些会有所迷糊的. ThreadLocal 本身的命名有有问题, 这些美国精英整出来的技术,再加上一个奇怪的命名.对我们中国人来说,就是一场 ...

  7. leetcode140

    class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type word ...

  8. 完美解决ubuntu下sublime中文输入问题

    声明 1.本人整理文章,转载请注明出处. 2.参考资料 http://my.oschina.net/tsl0922/blog/113495 问题描述 在ubuntu下想使用sublime,但是不能输入 ...

  9. PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用

    在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文.Name用来显 示,Code在代码中使用,但Comment中的文字会保 ...

  10. MySql.Data.MySqlClient连接MySql

    在C#中连接MySql数据库其实是件很简单的事情,但对于刚开始学习C#的朋友来说,问题却是不小,主要原因是相对于ACCESS和MSSql来说,MySql方面的教程文章实在太少,我也是自己摸索好好半天才 ...