swagger-api / swagger-api/swagger-codegen

Unable to compile swagger-codegen owing to 501 error from the parent POM

Open
#10,353 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Unable to compile swagger-codegen owing to 501 error from the parent POM.

Swagger-codegen version

3.0.0

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
  1. Clone this repo.
  2. cd swagger-codegen
  3. mvn clean compile or mvn clean package

It shows the following error -

~/code/swagger/swagger-codegen:mvn clean package
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project io.swagger:swagger-codegen-project:2.4.15-SNAPSHOT (/Users/muthu/code/swagger/swagger-codegen/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not transfer artifact org.sonatype.oss:oss-parent:pom:5 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. and 'parent.relativePath' points at wrong local POM @ line 2, column 13 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
~/code/swagger/swagger-codegen:

These are the lines that show the problem -

Downloading: http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom
...
...
...
[ERROR]   The project io.swagger:swagger-codegen-project:2.4.15-SNAPSHOT (/Users/muthu/code/swagger/swagger-codegen/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not transfer artifact org.sonatype.oss:oss-parent:pom:5 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. and 'parent.relativePath' points at wrong local POM @ line 2, column 13 -> [Help 2]

Trying this in the browser -

http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom

Also yields a similar result -

501 HTTPS Required. 
Use https://repo.maven.apache.org/maven2/
More information at https://links.sonatype.com/central/501-https-required

I am surprised that more people haven't run into this. Unless, I am doing / understanding something completely wrong here.

Related issues/PRs
Suggest a fix/enhancement

In the parent POM, if the URL was changed to https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom, then this problem should be resolved. We need https in the parent pom, instead of http.

Trying to reach -

https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom

comes back with a proper response -

<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.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
<packaging>pom</packaging>
<name>Sonatype OSS Parent</name>
<url>
http://nexus.sonatype.org/oss-repository-hosting.html
</url>
<description>
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
</description>
<scm>
<connection>
scm:svn:http://svn.sonatype.org/spice/tags/oss-parent-5
</connection>
<developerConnection>
scm:svn:https://svn.sonatype.org/spice/tags/oss-parent-5
</developerConnection>
<url>http://svn.sonatype.org/spice/tags/oss-parent-5</url>
</scm>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>
https://oss.sonatype.org/content/repositories/snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
...
...
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the root pom.xml and its parent declaration, then run mvn clean compile or mvn clean package to reproduce the HTTPS Required error. Update the parent repository URL from HTTP to HTTPS as described in the issue, and confirm the build can resolve oss-parent successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.