How to change maven repository url on gradle

36 Views Asked by At
publishing {
    repositories {
        maven {
            url "http://localhost:8081/repository/maven-releases/"
            allowInsecureProtocol true
            credentials {
                username project.repoUser
                password project.repoPassword
            }
        }
    }
    publications {
        maven(MavenPublication) {
            groupId = 'com.aca.lil'
            artifactId = 'arrrlib'
            from components.java
        }
    }
}

I published this code by Nexus.

If I use this library, I should write this code.

maven {
        url "http://localhost:8081/repository/maven-releases/"
        allowInsecureProtocol = true
    }

I wanna change this url to https. Like https://repo.aca.com/repository/maven-public/

publishing {
    repositories {
        maven {
            url "http://localhost:8081/repository/maven-releases/"
            allowInsecureProtocol true
            credentials {
                username project.repoUser
                password project.repoPassword
            }
        }
    }
    publications {
        maven(MavenPublication) {
            groupId = 'com.aca.lil'
            artifactId = 'acalil'
            from components.java
        }
    }
}

I published this code on Nexus Repository. If i use this library, I should write this code.

maven {
        url "http://localhost:8081/repository/maven-releases/"
        allowInsecureProtocol = true
    }

I wanna change this url to https. Like https://repo.aca.com/repository/maven-public/

How can I change this url? I wanna know right way to change it. Also is it good build.gradle code?

1

There are 1 best solutions below

0
Gonçalo Montalvão Marques On

Your question is a bit confusing....

Anyways, firstly if you are waiting to publish things to your local Nexus repository, you should use the publishToMavenLocal task, see the reference doc.

Secondly, you should be able to set whatever url for your repositories like explained here.