简体   繁体   English

Spring Boot 1.5.9应用程序无法在Java 1.7中运行

[英]Spring Boot 1.5.9 application not working in Java 1.7

I've developed a Spring boot(2.0.6) application in Java 8, which is working fine. 我已经用Java 8开发了一个Spring boot(2.0.6)应用程序,它运行良好。 Now i need to convert that project into Java 7 (so i've changed Spring boot version to 1.5.9.RELEASE, Java_home to 1.7 folder, Installed JREs to Jdk 1.7. Also added Jdk 1.7 in java build path). 现在,我需要将该项目转换为Java 7(因此,我已将Spring引导版本更改为1.5.9.RELEASE,将Java_home更改为1.7文件夹,将JRE安装到Jdk 1.7。还在Java构建路径中添加了Jdk 1.7)。

After i changed all the settings, my pom.xml is throwing "non-resolvable parent POM". 更改所有设置后,我的pom.xml抛出“不可解析的父POM”。 When i Tried to build using maven, its throwing the following exception "Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.5.9.RELEASE from/to central ( https://repo.maven.apache.org/maven2 ):" 当我尝试使用Maven进行构建时,它抛出以下异常“无法将工件org.springframework.boot:spring-boot-starter-parent:pom:1.5.9.RELEASE从/转移到中心( https:// repo。 maven.apache.org/maven2 ):”

My POM.xml 我的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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.logicInfo.oms</groupId>
<artifactId>SlotBookingAvailability</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>SlotBookingAvailability</name>
<description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
    </parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.7</java.version>
</properties>

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

    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc7</artifactId>
        <version>12.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20180813</version>
    </dependency>

</dependencies>

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

</project>

Could anyone please help me to resolve this? 有人可以帮我解决这个问题吗?

To work around non-resolvable parent POM error add <relativePath/> element 要变通解决不可解决的父POM错误,请添加<relativePath/>元素

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath/>
</parent>

If you are on Java 1.7 below 1.7.0_131-b31 it won't support TLS 1.2 and you won't be able to download from https://repo.maven.apache.org which only supports TLS 1.2 . 如果您使用的Java 1.7 低于1.7.0_131-b31,则它将不支持TLS 1.2,并且您将无法从仅支持TLS 1.2的 https://repo.maven.apache.org下载。 This is why you are getting: 这就是为什么您得到:

Received fatal alert: protocol_version 

Change your Maven Central configuration to use plain HTTP http://repo.maven.apache.org . 将您的Maven Central配置更改为使用纯HTTP http://repo.maven.apache.org

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM