Gradle Settings plugin ws.gross.private-repo
to configure private repository (Nexus, Artifactory) with sane defaults (for me).
Also contains these project plugins:
-
ws.gross.private-repo-publish
plugin to configuremaven-publish
publishing repositories; -
ws.gross.bootstrap-manifest
to generate manifest files; -
ws.gross.release-approve
to add release approval task whennebula.release
plugin present.
❗
|
Supports Gradle 6.8+. |
Configured via gradle properties (e.g. in ~/.gradle/gradle.properties
).
Property | Description | Default | Example |
---|---|---|---|
|
Nexus base URL |
— |
|
|
Nexus user name for repo |
— |
deploy-user |
|
Nexus user password for read access |
— |
some-secret-password |
|
Nexus repo or group to add |
|
|
|
Use private repo as exclusive for groups and regexes |
|
|
|
Groups to exclude from Maven Central |
empty |
|
|
Regexes for groups to exclude when searching Maven Central |
derived from |
|
|
Flag to enable generating default group regex from |
|
|
|
Comma-separated list of manifest |
empty |
com.example:bootstrap:1.0.0, com.example.platforms:platforms:1.5.0 |
|
Add version catalogs from bootstrap manifest |
|
|
|
Releases repo id for |
|
|
|
Snapshots repo id for |
|
🔥
|
\ and : in gradle.properties requires escaping, so you have to use \\. /\: instead of \. /:
|
// Bootstrap manifest artifacts contains properties file with comma-separated plugin ids (`pluginIds` field), catalog (name=dependencyNotation pairs) and `version`.
// for manifest
// catalogIds = commonLibs\=com.example.common\:catalog
// pluginIds = com.example.first, com.example.second
// version = 1.2
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = "nexus"
url = uri("$nexusUrl/repository/$nexusRepo")
}
}
plugins {
// from manifest
id("com.example.first") version("1.2")
id("com.example.second") version("1.2")
}
}
dependencyResolutionManagement {
versionCatalogs {
// for each catalog in manifest catalogIds
create("commonLibs") { // from key
from("com.example.common:catalog:1.2") // from value and version
}
}
repositories {
mavenCentral {
groups.forEach { excludeGroup(it) }
groupRegexes.forEach { excludeGroupByRegex(it) }
// default exclude regex like `com\\.example(\\..*)?` is added if both `nexusGroups` and `nexusGroupRegexes` are empty
}
// when `nexusExclusive` not set or set to false
maven {
name = "nexus"
url = uri("$nexusUrl/repository/$nexusRepo")
// use `nexusUsername` and `nexusPassword` gradle properties to authenticate
credentials {
username = "$nexusUsername"
password = "$nexusPassword"
}
authentication.create<BasicAuthentication>("basic")
}
// when `nexusExclusive` is set to true
exclusiveContent {
forRepository {
maven {
name = "nexus"
url = uri("$nexusUrl/repository/$nexusRepo")
// use `nexusUsername` and `nexusPassword` gradle properties to authenticate
credentials {
username = "$nexusUsername"
password = "$nexusPassword"
}
authentication.create<BasicAuthentication>("basic")
}
}
filter {
groups.forEach { includeGroup(it) }
groupRegexes.forEach { includeGroupByRegex(it) }
// default include regex like `com\\.example(\\..*)?` is added if both `nexusGroups` and `nexusGroupRegexes` are empty
}
}
}
}
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.