2
votes

I've developed a Spring boot(2.0.6) application in Java 8, which is working fine. 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).

After i changed all the settings, my pom.xml is throwing "non-resolvable parent 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):"

My 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?

1
"Could not transfer artifact" looks like a connection issue.Tom
But this project works fine in my machine when i use Java 8 to run.Charan
Is this the whole error message? Just "couldn't transfer"? Does this project correctly build with Java 7 when you remove the parent pom (and add <version> tags to the Spring dependencies)?Tom
I tried building the application after removed the parent tag and included version tag to the spring dependencies. Getting exception - Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (repo.maven.apache.org/maven2): Received fatal alert: protocol_versionCharan
stackoverflow.com/questions/50824789/… Your maven needs to switch to TLS 1.2Compass

1 Answers

3
votes

To work around non-resolvable parent POM error add <relativePath/> element

<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. 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.