GitLab Conventions

The no.conta.gitlab-conventions plugin configures GitLab Maven repositories.

If you provide a gitlabProjectId it also configures a repository for publishing.

Configure

plugins {
    id 'java'
    id 'no.conta.gitlab-conventions' (1)
}

repositories { (2)
    mavenCentral() // needed due to transitive micronaut-bom dependency
}

dependencies {
    compileOnly 'no.conta:conta-problem-json-api:+'
}

gitlabRepositories {
    contaOpen {            (3)
        groupId '12992043'
    }

    contaProblemJson {     (4)
        projectId '31009252'
    }
}

tasks.register('listRepositories') { t ->
    t.doLast {
        repositories.each { MavenArtifactRepository repo ->
            println "${repo.name} -> ${repo.url}"
        }
    }
}
1 apply the plugin
2 adds a repository because of gitlabGroupId from gradle.properties
3 adds a named group repository using groupId
4 adds a named project repository using projectId
gradle.properties
gitlabGroupId=12992043
gitlabProjectId=30547514

Conta Configuration

build.gradle
repositories {
    maven gitlab.conta()     (1)
    maven gitlab.contaOpen() (2)
}
1 add Conta repository using convenience method
2 add ContaOpen repository using convenience method

List repositories

build.gradle
> gradle listRepositories

MavenRepo -> https://repo.maven.apache.org/maven2/
GitLab -> https://gitlab.com/api/v4/groups/12992043/-/packages/maven
ContaOpen -> https://gitlab.com/api/v4/groups/12992043/-/packages/maven
ContaProblemJson -> https://gitlab.com/api/v4/projects/31009252/packages/maven

Maven Publish

If the property gitlabPublishToProjectId is provided the plugin reacts to the maven-publish plugin by adding a publishing repository.

gitlabPublishToProjectId=30547514
plugins {
  id 'java'
  id 'no.conta.gitlab-conventions' version '<version>'
  id 'maven-publish'
}