Add support for custom maven repositories with credentials
See original GitHub issueIn our custom instance we would like to add a maven repository which requires credentials.
For maven projects, this works because the user can define the credentials in ~/.m2/settings.xml
while referencing the maven repository-id.
For gradle projects this doesn’t work. The gradle-way to accomplish this, looks like this:
maven {
url 'https://artifacts.mycompany.com/snapshots'
credentials {
username property("com.mycompany.artifacts.username")
password property("com.mycompany.artifacts.password")
}
}
This is currently not supported by Initializr.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to specify credentials for custom maven private repo
You can set in .m2/settings.xml file. Like This: <settings> <servers> <server> <id>private-repo</id> <username>xyz</username> ...
Read more >Guide to using Multiple Repositories - Apache Maven
The first way is to specify in a POM which repositories you want to use. That is supported both inside and outside of...
Read more >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 >Your private maven repository - myMavenRepo.com
There is difference between repository credentials and service credentials. Don't mess them up. Help / Configuring Maven pom.xml file for HTTP Basic Auth ......
Read more >How to use Enterprise Maven Repository credentials with ...
To configure your Enterprise Maven Repository credentials with embedded Maven to allow you to reference and use dependencies only available from the ...
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
My proposal:
credentials
field to theMavenRepository
model. The type would be aMavenRepositoryCredentials
object withusername
&password
fields. (Or a key-value map-like object, which would facilitate extending this to non-basic-auth later on.)2a. The maven-build-writer can ignore the
credentials
field - just like the gradle-build-writer is ignoring thename
andsnapshotsEnabled
fields fromMavenRepository
2b. The gradle-build-writer can check if there are (non-default) credentials provided and write those to the build.gradle if necessary. Currently the gradle-build-writer can only write repositories on a single line (like
maven { url 'https://repo.spring.io/snapshot' }
).To support a representation which includes
credentials
info, the implementation ofGradleBuildWriter#writeRepositories
should be updated and the method signatureshould change into something that can (optionally) write multi-line repository information, like
We hope to address it at some point, that’s why the issue has not be closed. We don’t have any firm plans or a date in mind at the moment, however.