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

第一部分:使用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. springmvc项目搭建三-添加前端框架

    这几年前端框架发展可以说非常迅猛了...实际项目中也用到了几个,easyui相对来讲,算是我第一个接触的前端框架了,用的时候感觉很方便,省了很多代码量,一个好的前端框架可以为你省去很多精力在前端布局上 ...

  2. js文字跳动效果

    /*! * chaffle v1.0.0 * * Licensed under MIT * Copyright 2013-2014 blivesta * http://blivesta.com */ ...

  3. 【bzoj1856】[Scoi2010]字符串 Catalan数

    题目描述 lxhgww最近接到了一个生成字符串的任务,任务需要他把n个1和m个0组成字符串,但是任务还要求在组成的字符串中,在任意的前k个字符中,1的个数不能少于0的个数.现在lxhgww想要知道满足 ...

  4. BZOJ4652 [Noi2016]循环之美 【数论 + 莫比乌斯反演 + 杜教筛】

    题目链接 BZOJ 题解 orz 此题太优美了 我们令\(\frac{x}{y}\)为最简分数,则\(x \perp y\)即,\(gcd(x,y) = 1\) 先不管\(k\)进制,我们知道\(10 ...

  5. 牛客网暑期ACM多校训练营(第十场)D Rikka with Prefix Sum (数学)

    Rikka with Prefix Sum 题意: 给出一个数组a,一开始全为0,现在有三种操作: 1.  1 L R W,让区间[L,R]里面的数全都加上W: 2.  2     将a数组变为其前缀 ...

  6. 7月11日day3总结

    今天学习过程和总结 一 1.输出流的字符流.字节流 2.加锁.多线程的理解,产生的原因.cpu同时运行最大数.其他的都在及时切换.1.继承Thred类,重写run方法. 2.实现Runnable接口. ...

  7. win安装pycurl和linux安装pycurl

    1.win pip install wheel http://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载对应的包: pip install e:\pycurl-7.4 ...

  8. linux fg bg ctrl + z jobs & 等命令

    fg.bg.jobs.&.ctrl + z都是跟系统任务有关的,虽然现在基本上不怎么需要用到这些命令,但学会了也是很实用的一.& 最经常被用到这个用在一个命令的最后,可以把这个命令放到 ...

  9. clips 前端 js 倒计时 获取验证码的按钮

    <a href="javascript:void(0);" onclick="get_captcha()" class="btn btn-def ...

  10. 【转】beyond compare 启动提示“应用程序发生错误”

    [转]beyond compare 启动提示“应用程序发生错误”   今天到公司BCompare不能打开,重新安装也不能打开.最后处理下,就解决了.方法是把C:\Documents and Setti ...