• 【spring Boot】2.在Myecplise上把spring Boot项目打包 war包和jar包


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

    第一部分:使用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>
    View Code

    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:workspace2firstSpringBootExample	arget
    [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:workspace2firstSpringBootExample	argetclasses
    [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
    View Code

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

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

    5.执行之后结果如下:

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

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

  • 相关阅读:
    tp 30秒超时
    zend studio git 提示错误
    php连接数据库
    php点击排序
    表情符号解析
    js Object.assign 方法
    Web界面简繁体转换
    H5骨架屏实战
    JavaScript heap out of memory问题
    Vue bus插件封装
  • 原文地址:https://www.cnblogs.com/sxdcgaq8080/p/7617547.html
Copyright © 2020-2023  润新知