Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 版本2.1.7的Maven配置问题-Spring引导_Java_Maven_Spring Boot - Fatal编程技术网

Java 版本2.1.7的Maven配置问题-Spring引导

Java 版本2.1.7的Maven配置问题-Spring引导,java,maven,spring-boot,Java,Maven,Spring Boot,当我尝试使用新版本“v2.1.7”创建SpringBoot项目时 org.springframework.boot spring启动程序父级 2.1.7.发布 这一次是通过以下错误实现的: 说明资源路径位置 类型 未知pom.xml/demo-1第1行Maven配置问题 如果我要用名称空间将porm.xml文件中的这个新版本替换为我以前的旧版本,它工作正常,没有任何错误, 若我删除了.m2文件夹并重新安装了eclipse,那个么它对新版本的支持,但我想将现有的eclipse与新版本的Spri

当我尝试使用新版本“v2.1.7”创建SpringBoot项目时


org.springframework.boot
spring启动程序父级
2.1.7.发布
这一次是通过以下错误实现的:

说明资源路径位置
类型 未知pom.xml/demo-1第1行Maven配置问题

如果我要用名称空间将porm.xml文件中的这个新版本替换为我以前的旧版本,它工作正常,没有任何错误, 若我删除了.m2文件夹并重新安装了eclipse,那个么它对新版本的支持,但我想将现有的eclipse与新版本的Spring Boot一起使用,我能为它做些什么呢

是否可以更新现有的.m2文件夹

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo-1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo-1</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
org.springframework.boot
spring启动程序父级
2.1.7.发布
com.example
演示-1
0.0.1-快照
演示-1
SpringBoot的演示项目
1.8
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
弹簧靴开发工具
运行时
真的
org.springframework.boot
弹簧起动试验
测试
org.springframework.boot
springbootmaven插件
当我这次尝试安装maven时,出现以下错误显示

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< com.example:demo-1 >-------------------------
[INFO] Building demo-1 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo-1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ demo-1 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Enternship\SPRING BOOT\demo-1\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: 5.933 s
[INFO] Finished at: 2019-09-02T18:45:56+05:30
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project demo-1: 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
[INFO]正在扫描项目。。。
[信息]
[信息]----------------------------------------------------
[信息]构建演示-10.0.1-快照
[信息]------------------------------------[jar]---------------------------------
[信息]
[信息]---maven资源插件:3.1.0:resources(默认资源)@demo-1---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]正在复制1个资源
[信息]正在复制0资源
[信息]
[信息]---maven编译器插件:3.8.1:编译(默认编译)@demo-1---
[信息]检测到更改-重新编译模块!
[INFO]正在将1个源文件编译为D:\Enternship\SPRING BOOT\demo-1\target\classes
[信息]-------------------------------------------------------------
[错误]编译错误:
[信息]-------------------------------------------------------------
[错误]此环境中未提供编译器。也许您运行的是JRE而不是JDK?
[INFO]1错误
[信息]-------------------------------------------------------------
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:5.933秒
[信息]完成时间:2019-09-02T18:45:56+05:30
[信息]------------------------------------------------------------------------
[警告]无法激活请求的配置文件“pom.xml”,因为它不存在。
[错误]无法在项目demo-1上执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile(默认编译):编译失败
[错误]此环境中未提供编译器。也许您运行的是JRE而不是JDK?
[错误]->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误][帮助1]http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

只需配置JDK路径,步骤如下

  • 右键单击项目
  • 点击属性
  • 键入java构建路径并转到java构建路径
  • 点击图书馆
  • 单击JRE系统库
  • 编辑那个
  • 单击备用JRE
  • 单击已安装的JRE
  • 点击添加
  • 选择标准虚拟机
  • 单击下一步
  • 放置JDK路径并选择该路径
  • 这样,您就不会看到错误

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

    你能发布完整的
    pom.xml
    文件吗?同样,完整的错误输出最好在普通命令行上运行…你的文件真的命名为
    porm.xml
    ,还是问题中的拼写错误?对不起,它的拼写错误,它的实际名称是pom.xml错误告诉你出了什么问题
    [错误]未能在project demo-1上执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile(默认编译):编译失败[错误]此环境中未提供编译器。也许您是在JRE而不是JDK上运行的?
    您是在用JRE而不是JDK运行构建(后者确实包含
    javac
    ,前者并不因此产生错误)。
    =>No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?