ysb33r / ivypot-gradle-plugin

Ivypot is a Gradle plugin to help managing a local off-line repository for builds in restricted environments
Apache License 2.0
45 stars 14 forks source link

Added realm parameter for credentials (fix for #29) #38

Closed jhendess closed 5 years ago

jhendess commented 5 years ago

I had the same problem as issue #29 when I tried to access an authenticated Nexus repository via Ivypot. The issue seems to be that our company repository uses a different authentication realm which must be configured in the ivysettings.xml that is generated by ivypot.

You can check this if you run your gradle build with debug logging and see something like this:

[sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@3ca1f0a97 pairs: {null: HTTP/1.1 401 Unauthorized}{Date: Tue, 02 Apr 2019 09:54:02 GMT}{Server: Apache}{WWW-Authenticate: Basic realm="MyRealm"}

In this case "MyRealm" is the realm which must be configured in ivysettings.xml.

Since the file is always regenerated by Ivypot, I prepared a fix which adds the realm property to the credentials and writes the value to the generated ivysettings.xml file. Afterwards I could resolve my dependencies without any issues my defining my repository like this:

maven {
    url "https://repo.server.com/"
    credentials {
        username "MyUser"
        password "MyPassword"
        realm "MyRealm"
    }
}
ysb33r commented 5 years ago

Thank you!