Multiple repository set, repository with credentials in Gradle
See original GitHub issueI really like the idea behind this gradle plugin, however I found the settings thin too.
Actually there is a gradle repo for the co-workers in our company, but this repo is only reachable with credential data. There are stored the common libs. So my gradle file looks like this:
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven {
url "https://...."
credentials {
username = "${readerJfrogUser}"
password = "${readerJfrogUserPw}"
}
}
}
Its working fine If I build my stuff the original way, however, I can not set multiple repo url, and credentials (for them) in the settings section.
Can it be a future feature? Or has somebody any workaround ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
Declaring repositories - Gradle User Manual
Accessing authenticated Maven repositories. You can specify credentials for Maven repositories secured by different type of authentication. See Supported ...
Read more >Same credentials for all repositories in Gradle - Stack Overflow
Maybe you know - how in one place set same credentials for all maven repositories? I don't want to copy the same code...
Read more >Gradle Repositories - NovaOrdis Knowledge Base
Use properties instead of credentials in clear in build.gradle, and then initialize those properties into a local file, such as ~/.gradle/gradle ...
Read more >Maven artifacts | Bytesafe Documentation
Alternative mirror setup · Add multiple upstream sources for a registry · Provide project level configuration for package repository · Using Bytesafe together...
Read more >Adding Password Protected Maven Repository URL in Gradle
In my current project at work, I had to setup a private maven repository hosted at Artifactory. I was assigned login credentials to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We seem to have veered off topic from the original issue though, or am I missing something? The original topic was about custom repositories with credentials. It wasn’t anything to do with multistage docker builds and optimization of docker caches.
All you need to make it work is a Maven
settings.xml
with the repository credentials. You have to figure out a way to inject the secrets from environment variables, but I know it’s possible (plenty of docs if you google), and you already have that problem with thebuild.gradle
, so you must have solved it somehow.Okey, let me explain. We dont have this cache option, because our build system is not an usual one.
Dockerfile looks like this:
So we have no gradle cache in the jenkins (build) server, because we use a docker image for build (gradle:5.5.1-jdk11), and an another one for run it (openjdk:11-jre-slim). Our jenkins is abstract, and it handles nothing but docker build, and deploy.
So (with your solution), I have to make an automation, for making a builder docker image what would contain all the dependencies what it need for the build, and it should be changed as the deps changes… Its complicated.
My goal was a Dockerfile like this:
And why is it good for me? Because if a gradle command like buildonlydependencies would exist, the docker would handle it so well, because it can make a cache layer from it, so that step would come from the docker cache (if the deps does not change), and most of the time the build process should focus only the core.jar.
I hope you can understand now.