2

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?

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
Charan
  • 143
  • 1
  • 3
  • 8
  • "Could not transfer artifact" looks like a connection issue. – Tom Nov 01 '18 at 14:11
  • But this project works fine in my machine when i use Java 8 to run. – Charan Nov 01 '18 at 14:25
  • 1
    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 `` tags to the Spring dependencies)? – Tom Nov 01 '18 at 14:30
  • 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 (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version – Charan Nov 01 '18 at 14:35
  • https://stackoverflow.com/questions/50824789/why-am-i-getting-received-fatal-alert-protocol-version-or-peer-not-authentic Your maven needs to switch to TLS 1.2 – Compass Nov 01 '18 at 14:41
  • I tried to switch maven to TLS 1.2 as suggested. Getting below exception - [ERROR] Failed to execute goal on project SlotBookingAvailability: Could not res olve dependencies for project org.logicInfo.oms:SlotBookingAvailability:war:0.0. 1-SNAPSHOT: Could not find artifact com.oracle:ojdbc7:jar:12.1.0 in central (htt ps://repo.maven.apache.org/maven2) – Charan Nov 01 '18 at 14:54
  • I've added ojdbc7.jar in my mvn already – Charan Nov 01 '18 at 14:55

1 Answers1

3

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.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
  • Added in my pom.xml, still the same issue exists. – Charan Nov 01 '18 at 14:26
  • @Charam can you access [the pom file directly from Maven Central](https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/1.5.9.RELEASE/spring-boot-starter-parent-1.5.9.RELEASE.pom)? There are two problems, non-resolvable parent which you fixed and non-transferable pom. – Karol Dowbecki Nov 01 '18 at 14:27
  • Yes, i could able to access pom file from Central. – Charan Nov 01 '18 at 14:30
  • Running build with `-U` flag (e.g. `mvn -U clean install`) would be my last idea. Maybe there was a temporary network problem the first time you build it? – Karol Dowbecki Nov 01 '18 at 14:46
  • That also gives an exception - [ERROR] The project org.logicInfo.oms:SlotBookingAvailability:0.0.1-SNAPSHOT ( D:\SlotBookingAvailability_latest\pom.xml) has 1 error [ERROR] Non-resolvable parent POM for org.logicInfo.oms:SlotBookingAvailabil ity:0.0.1-SNAPSHOT: 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): Received fatal alert: protocol_version and 'parent.relativePath' p oints at no local POM @ line 14, column 11 -> [Help 2] – Charan Nov 01 '18 at 14:59
  • @Charan Most likely TLS version problem, updated the answer. – Karol Dowbecki Nov 01 '18 at 15:08
  • Actually i couldnt find settings.xml file in .m2 folder. Could you please tell me Where do i need to change the Central configuration? – Charan Nov 01 '18 at 15:15