Artifactory Gradle 插件仅部署 build.info

发布于 2025-01-14 21:34:09 字数 2475 浏览 4 评论 0原文

我有一个 Gradle 插件,想要使用 Gradle Artifactory 部署到 Artifactory 服务器插件

问题在于 artifactoryDe​​ploy 任务仅发布 build.info 元信息并跳过实际工件。您可以在日志中看到它。

> 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%20Mar%2017%2017:07:21%20MSK%202022

BUILD SUCCESSFUL in 1s

这是build.gradle。我做错了什么?

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)
}

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%20Mar%2017%2017:07:21%20MSK%202022

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)
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生再见 2025-01-21 21:34:09

好的,我找到了问题的根源。您应该将 artifactoryDe​​ploy 替换为 artifactoryPublish 命令。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文