Home > Software design >  Artifactory Gradle Plugin deploys only build.info
Artifactory Gradle Plugin deploys only build.info

Time:03-21

I have a Gradle plugin that I want to deploy to Artifactory server with Gradle Artifactory Plugin.

The problem is that artifactoryDeploy task publishes only build.info meta-information and skips the actual artifacts. You can see it in the logs.

> Task :artifactoryDeploy
Deploying build info...
Build-info successfully deployed. Browse it in Artifactory under http://my-company.artifactory.com/artifactory/webapp/builds/gradle-plugin/Thu Mar 17 17:07:21 MSK 2022

BUILD SUCCESSFUL in 1s

Here is the build.gradle. What am I doing wrong?

plugins {
    id 'java-gradle-plugin'
    id "com.jfrog.artifactory" version '4.27.1'
    id 'maven-publish'
    id 'com.gradle.plugin-publish' version '0.18.0'
}

gradlePlugin {
    plugins {
        somePlugin {
            id = 'com.example.gradle.plugin'
            displayName = 'Gradle Plugin'
            implementationClass = 'com.example.gradle.plugin.Plugin'
        }
    }
}

pluginBundle {
    website = 'https://company.gitlab.com/project'
    vcsUrl = 'https://company.gitlab.com/project'
    tags = ['plugin', 'codestyle', 'checkstyle', 'pmd']
}

publishing {
    publications {
        pluginPublication(MavenPublication) {
            from components.java
            groupId project.group
            artifactId 'my-plugin'
            version project.version
        }
    }
}

artifactory {
    contextUrl = 'http://my-company.artifactory.com'
    publish {
        repository {
            repoKey = 'gradle-plugins'
            username = project.properties['publishUser'] ?: 'user'
            password = project.properties['publishPassword'] ?: 'password'
        }
        defaults {
            publications(publishing.publications.names.toArray(String[]::new))
            publishBuildInfo = true
            publishArtifacts = true
            publishPom = true
            publishIvy = true
        }
    }
    // Redefine basic properties of the build info object
    def date = new Date().toString()
    clientConfig.setIncludeEnvVars(true)
    clientConfig.setEnvVarsExcludePatterns('*password*,*secret*')
    clientConfig.setEnvVarsIncludePatterns('*not-secret*')
    clientConfig.info.addEnvironmentProperty('test.adding.dynVar', date)
    clientConfig.info.setBuildName('MTS-Metric-Gradle-Plugin')
    clientConfig.info.setBuildNumber(date)
    clientConfig.timeout = 20
    clientConfig.setInsecureTls(true)
}

CodePudding user response:

OK, I found the source of the problem. You should replace artifactoryDeploy with artifactoryPublish command.

  • Related