簡體   English   中英

版本2.1.7的Maven配置問題-Spring Boot

[英]Maven Configuration Problem with Version 2.1.7 - Spring Boot

當我嘗試使用“ v 2.1.7”的新版本創建Spring Boot Project時

   <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

這次通過以下錯誤:

說明資源路徑位置
鍵入未知pom.xml / demo-1第1行Maven配置問題

如果我打算將此新版本替換為porm.xml文件中以前的舊版本並使用名稱空間,其工作正常,沒有任何錯誤,並且如果我刪除了.m2文件夾並重新安裝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>

當我這次嘗試在錯誤顯示后安裝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

只需配置JDK路徑,步驟是

  1. 右鍵點擊項目
  2. 點擊屬性
  3. 輸入Java構建路徑並轉到Java構建路徑
  4. 點擊圖書館
  5. 單擊JRE系統庫
  6. 編輯那個
  7. 單擊備用JRE
  8. 單擊已安裝的JRE
  9. 點擊添加
  10. 選擇標准虛擬機
  11. 點擊下一步
  12. 放置您的JDK路徑並選擇

這樣,您將看不到錯誤

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM