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. 关于QT编译错误问题

    这里的意思是出现QT编译错误: 1.之前编译没问题,突然就报错了,而且错误根本不知道啥玩意. 2.编译出现不能自动更新,比如更改ui但是编译之后没该改变. ... 解决方法: 1.删除Makefile ...

  2. android TextView 例子代码(文字图片、文字省略、文字滚动)

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  3. [UGUI]帧动画

    ImageFrameAnimation.cs using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [R ...

  4. js-杂记

    js可计算传值 <p>点击按钮计算 x 的值.</p> <button onclick="myFunction()">点击这里</butt ...

  5. 1.App爬取相关库的安装(安装Charles及手机端证书安装配置)

    一.官网下载Charles安装包: https://www.charlesproxy.com/download1.下载对应版本 我这里下载的是 win 64 bit (下载完解压,双击打开charle ...

  6. ubuntu 上 SSH scp 技巧

    参考:https://deepzz.com/post/how-to-setup-ssh-config.html SSH(Secure Shell)是什么?是一项创建在应用层和传输层基础上的安全协议,为 ...

  7. java环境变量配置方法

    原创文章,转载请注明出处. 这是本人2011-9-4记录的,现在把它放在博客上. windows xp下配置JDK环境变量: 1.安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为 ...

  8. Java安全编码标准

    Java安全编码标准 具体参考Rules 输入验证和数据净化(IDS)规则风险评估概要 IDS00-J净化穿越受信边界的非受信数据 IDS01-J验证前标准化字符串 IDS02-J在验证之前标准化路径 ...

  9. Mysql索引,有哪几种索引,什么时候该(不该)建索引;SQL怎么进行优化以及SQL关键字的执行顺序

    索引(Index)是帮助MySQL高效获取数据的数据结构.提取句子主干,就可以得到索引的本质:索引是数据结构. 1.按照索引列值的唯一性,索引可分为唯一索引和非唯一索引 非唯一索引:B树索引 crea ...

  10. Jsoup解析网页源码时常用的Element(s)类

    Jsoup解析网页源码时常用的Element(s)类 一.简介 该类是Node的直接子类,同样实现了可克隆接口.类声明:public class Element extends Node 它表示由一个 ...