========================================================第一部分=============================================================

第一部分:使用maven项目中自带的插件,将maven的web项目打包成war包

使用的项目是上一章中的maven项目,原封不动

看一下pom.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.sxd.springBootExample</groupId>
<artifactId>firstSpringBootExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<version>3.0</version>
</configuration>
</plugin>
</plugins>
</build> <!-- 引入parent项目,其实就是一个项目jar,版本自己在http://mvnrepository.com/search?q=spring-boot-starter-parent 选择即可 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
</parent> <!-- 要跑起来一个web项目,就引入这一个jar即可,版本不用写,parent中已经声明了的 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies> </project>

1.右键项目--->Debugs As--->Debugs Configurations

2.跟着步骤走

3.报错啦:

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK

[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building firstSpringBootExample 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ firstSpringBootExample ---
[INFO] Deleting D:\workspace2\firstSpringBootExample\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ firstSpringBootExample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ firstSpringBootExample ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\workspace2\firstSpringBootExample\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.398 s
[INFO] Finished at: 2017-10-01T17:41:26+08:00
[INFO] Final Memory: 13M/232M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project firstSpringBootExample: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

解决方法:http://www.cnblogs.com/sxdcgaq8080/p/7617542.html

4.解决错误之后,重新进行打包操作

5.执行之后结果如下:

=====================================================第二部分=========================================================

第二部分,使用springBoot提供的插件,将项目打包为jar包

【spring Boot】2.在Myecplise上把spring Boot项目打包 war包和jar包的更多相关文章

  1. 通过idea 打包 spring maven项目打包为可执行jar包

    用assembly打包一直报错: shangyanshuodeMacBook-Pro:target shangyanshuo$ java -jar jobscrawler-1.0-SNAPSHOT-j ...

  2. spring boot:在项目中引入第三方外部jar包集成为本地jar包(spring boot 2.3.2)

    一,为什么要集成外部jar包? 不是所有的第三方库都会上传到mvnrepository, 这时我们如果想集成它的第三方库,则需要直接在项目中集成它们的jar包, 在操作上还是很简单的, 这里用luos ...

  3. 关于IDEA的Maven打jar包springboot项目问题,打成可执行jar包,IDEA创建的maven项目和spring initializr项目

    Spring Initializr创建的项目 源文件地址 https://github.com/TaoPanfeng/maven-package 项目的创建步骤 进行打包 clear package ...

  4. 使用maven-shade-plugin打包spring项目为可执行的jar包

    使用maven-shade-plugin打包spring项目为可执行的jar包,打包后的jar包里面包含依赖的jar包. POM文件: <plugin> <groupId>or ...

  5. spring项目使用mave将第三方jar包打进war包中

    背景:一个标准的ssm项目,需要使用到第三方jar,现需要将项目发布到liunx的服务器上,将项目打成war包,第三方war包也需要打进去 首先是直接打包,发现第三方jar包并没有打进去......蛋 ...

  6. Spring Boot 2.0 Intellij Idea 中图文详解打包成可执行Jar

    我们使用Spring Boot 2.0 创建好我们的项目后,我们一般需要打包,然后部署到服务器上. 打包步骤: 1. 选中项目,右键——> Open Module Settings. 2. 切换 ...

  7. Spring Boot打war包和jar包的目录结构简单讲解

    Spring Boot项目可以制作成jar包和war包,其目录结构是不一样的,具体的如下所示: 1.war包目录结构分析WAR(Web Archivefile)网络应用程序文件,是与平台无关的文件格式 ...

  8. 8.spring:事务管理(上):Spring的数据库编程、编程式事务管理

    Spring的数据库编程 Spring框架提供了JDBC模板模式------>JdbcTemplate 简化了开发,在开发中并不经常是使用 实际开发更多使用的是Hibernate和MyBatis ...

  9. IDEA下spring boot项目打包war包部署外部tomcat问题

    第一步,修改配置pom.xml文件 <packaging>war</packaging> <dependency> <groupId>org.sprin ...

随机推荐

  1. hdu1576逆元的一道水题

    hdu 1576 Problem Description 要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1).   ...

  2. easyui中tab页中js脚本无法加载的问题及解决方法

    我发现tab页中<script src="xxx.js">方式加载的脚本没有生效,firebug看请求也没有请求相应的脚本文件. 单独在浏览器中打开tab页中的页面js ...

  3. GCC 中 -L、-rpath和-rpath-link的区别

    GCC 中 -L.-rpath和-rpath-link的区别 来源 http://blog.csdn.net/q1302182594/article/details/42102961 关于这3个参数的 ...

  4. C++11 tuple元组

    C++11 tuple 元组 tuple容器(元组), 是表示元组容器, 是不包含任何结构的,快速而低质(粗制滥造, quick and dirty)的, 可以用于函数返回多个返回值; tuple容器 ...

  5. [洛谷P4389]付公主的背包

    题目大意:有$n(n\leqslant10^5)$种物品,第$i$个物品体积为$v_i$,都有$10^5$件.给定$m(m\leqslant10^5)$,对于$s\in [1,m]$,请你回答用这些商 ...

  6. RocketMQ 源码分析 RouteInfoManager(四)

    在上一章分析了NamesrvController的构造函数时,会生成一个RouteInfoManager对象,该对象存放着整个消息集群的相关消息,所以这里单独拿出来分析.其实试想一下namesrv的功 ...

  7. Codeforces Round #421 (Div. 2) D. Mister B and PR Shifts

    Codeforces Round #421 (Div. 2) D. Mister B and PR Shifts 题意:给一个长度为\(n\)的排列,每次可以向右循环移位一次,计算\(\sum_{i= ...

  8. BZOJ2716 [Violet 3]天使玩偶 【CDQ分治】

    题目 输入格式 输出格式 输入样例 //样例太长就不贴了.... 输出样例 //见原题 提示 题解 我们将曼哈顿距离式子中的绝对值去掉,每次只考虑x,y比当前点小的更新答案. 为了使所有点都对答案进行 ...

  9. 雅礼集训 Day2 T3 联盟 解题报告

    联盟 题目描述 \(\text{G}\) 国周边的 \(n\) 个小国家构成一个联盟以抵御 \(\text{G}\) 国入侵, 为互相支援,他们建立了\(n−1\) 条双向通路, 使得任意两个国家可以 ...

  10. ionic2.x 手动搭建开发环境教程分享(nodejs,jdk,ant,androidsdk)

    1.ionic简介 为什么选用ionic: 1.     彻底开源且免费 2.     性能优异 3.     基于红的发紫的AngularJs 4.     漂亮的UI 5.     强大的命令行( ...