mkristian / jbundler

bundler support for jars for jruby
MIT License
210 stars 39 forks source link

Unable to access maven repos with http:// #93

Closed aditya0711 closed 4 years ago

aditya0711 commented 4 years ago

Since Maven has turned of http access for all of its repos https://support.sonatype.com/hc/en-us/articles/360041287334

The error I'm getting:

Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.61/bcprov-jdk15on-1.61.pom. Return code is: 501, ReasonPhrase:HTTPS Required.

I have not been able to configure jBundler to use a custom url using environment variables.

RUN export JBUNDLE_SETTINGS=jbundler-settings.xml
RUN jbundle install

Contents of jbundler-settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <mirrors>
    <mirror>
      <id>internal-repository</id>
      <name>Maven Repository Manager running on repo.mycompany.com</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>jdk-1.4</id>
      <repositories>
        <repository>
          <id>repo-maven</id>
          <name>your custom repo</name>
          <url>https://repo.maven.apache.org/maven2</url>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>

I have tried both mirror everything and custom repo approach, am I doing this wrong? or is there a way to set a custom repo for maven?

aditya0711 commented 4 years ago

Fixed it by adding the repository field in Jarfile. Anyone facing a similar issue can use the following as reference Jarfile. Add this to the top of your Jarfile repository :first, https://orgName.com/repo

The :first keyword is important, without which maven defaults to the http maven repo.