PokeAPI/pokekotlin

HTTPS issues

BenjaminChilson opened this issue · 8 comments

Add dependencies pom.xml of my project:

Failed to collect dependencies for ... Could not transfer artifact ... from/to central ... Failed to transfer file ... Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
<?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>com.mycompany</groupId>
    <artifactId>PokemonProject</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <repositories>
	<repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
	</repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.github.PokeAPI</groupId>
            <artifactId>pokekotlin</artifactId>
            <version>2.3.1</version>
            <type>jar</type>
        </dependency>
    </dependencies>
</project>

When trying to run my project I get the error of:

Failed to execute goal on project PokemonProject: Could not resolve dependencies for project com.mycompany:PokemonProject:jar:1.0-SNAPSHOT: Failed to collect dependencies for [com.github.PokeAPI:pokekotlin:jar:2.3.1 (compile)]: Failed to read artifact descriptor for com.squareup.retrofit2:retrofit:jar:2.8.1: Could not transfer artifact com.squareup.retrofit2:retrofit:pom:2.8.1 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/com/squareup/retrofit2/retrofit/2.8.1/retrofit-2.8.1.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]

Could you post your pom.xml?

Try adding another repository block for jcenter before the jitpack one:

    <repository>
      <id>jcenter</id>
      <url>https://jcenter.bintray.com/</url>
    </repository>

Added that line to my pom.xml file, now it is getting farther, but receive this error:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project PokemonProject: Execution default-cli of goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec failed: Plugin org.codehaus.mojo:exec-maven-plugin:1.2.1 or one of its dependencies could not be resolved: Failed to collect dependencies for org.codehaus.mojo:exec-maven-plugin:jar:1.2.1 (): Failed to read artifact descriptor for junit:junit:jar:3.8.2: Could not transfer artifact junit:junit:pom:3.8.2 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/junit/junit/3.8.2/junit-3.8.2.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]

Interesting that it’s still trying to hit Maven Central with an outdated URL. What’s your Maven version? It likely needs an update.

Also, check your global settings.xml. Here’s the documentation to find where it’s located: http://maven.apache.org/settings.html

I updated my maven version to 3.6.3

I have located my global settings.xml. What would I need to look for and change in that file

The original error you posted is “Return code is: 501 , ReasonPhrase:HTTPS Required”. Maven is connecting to the Maven Central Repository with http instead of https, but https is required.

If the global settings.xml file you have is the one in your home directory, you should be able to just delete it and have a new one generated on next run of your updated Maven. Alternatively, look through the xml for the maven central URL and update it to https.

Maven in IDE was different from Maven installed seperatley. IDE Maven was an earlier version, brought up to 3.6.3 after updating.

HTTPS error has gone away.