Gradle with artifactory

Tho*_*hom 6 artifactory gradle

我正在尝试建立自己的常春藤存储库以用于我自己的库.我发现了神器,并决定在我的Ubuntu服务器上使用它.我按照这里的指示:

http://www.jfrog.com/video/artifactory-1-min-setup/

并创建了这个自动脚本:

buildscript {
    repositories {

        ivy {
            url 'http://picard:8080/artifactory/plugins-release'

        }
    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            maven = false
            ivy {
                ivyLayout = '[organization]/[module]/[revision]/[type]s/ivy-[revision].xml'
                artifactLayout = '[organization]/[module]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]'
                mavenCompatible = false
            }
        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            maven = false
            ivy {
                ivyLayout = '[organization]/[module]/[revision]/[type]s/ivy-[revision].xml'
                artifactLayout = '[organization]/[module]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]'
                mavenCompatible = false
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

从这里,我修改了我的build.gradle这样:

buildscript {
    repositories {
        mavenLocal()
        ivy {
            url 'http://picard:8080/artifactory/plugins-release'
        }
    }
}

apply plugin: 'java'
apply plugin: "com.jfrog.artifactory"

archivesBaseName = 'heavyweight-software-util'

repositories {
    mavenCentral()
    ivy {
        url 'http://picard:8080/artifactory/plugins-release'
    }
}

dependencies {
    classpath("org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3")
    testCompile("junit:junit:4.11")
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.8'
}


artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            maven = false
            ivy {
                ivyLayout = '[organization]/[module]/[revision]/[type]s/ivy-[revision].xml'
                artifactLayout = '[organization]/[module]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]'
                mavenCompatible = false
            }
        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            maven = false
            ivy {
                ivyLayout = '[organization]/[module]/[revision]/[type]s/ivy-[revision].xml'
                artifactLayout = '[organization]/[module]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]'
                mavenCompatible = false
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我执行构建时,我得到:

A problem occurred evaluating root project 'Utility'.
> Plugin with id 'com.jfrog.artifactory' not found.
Run Code Online (Sandbox Code Playgroud)

我试过谷歌搜索这个错误,但没有找到任何有用的东西.有人可以帮我解决这个错误吗?我是新手.

谢谢.

Tho*_*hom 13

在这里找到解决方案:http://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin

基本上,我使用以下行修改了我的构建脚本:

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0"
  }
}
apply plugin: "com.jfrog.artifactory"
Run Code Online (Sandbox Code Playgroud)

这与其构建脚本生成器生成的内容完全不同.希望这有助于其他人.