Control Publication in Sub-Projects with Gradle

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo

The Gradle Artifactory Plugin allows you to define different publication configuration for sub projects. You may also define the configuration once for the whole project by defining the artifactory closure only in the root project. The plugin also lets you disable publication for a sub-module.

  • When defining the configuration anywhere in the hierarchy, all sub-projects beneath it inherit the configuration and can override it whether it is defined in the root or in a sub-project.

  • Each sub-project can override the publish closure or the repositories closure, or both of them.

    Example for overriding publication only

    artifactory {
            publish {
                    contextUrl = 'http://localhost:8081/artifactory'
                    repository {
                            repoKey = "libs-snapshot-local"
                            username = "user"
                            password = "pass"
                    }
            }
    }
  • For buildInfo to be published, a publish closure must be defined in the root project.

  • Use the artifactoryPublish.skip flag to deactivate analysis and publication.

  • Activate the corresponding artifactoryPublish Gradle task manually for each project to which you wish to apply the plugin. For example in our Gradle project examples you can run:

    Activating the plugin manually

    ./gradlew clean api:artifactoryPublish shared:artifactoryPublish