Gradle 有神器

Gradle with artifactory

我正在尝试建立我自己的 ivy 存储库以供我自己的图书馆使用。我发现了 artifactory 并决定在我的 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
            }
        }
    }
}

据此,我将 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
            }
        }
    }
}

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

A problem occurred evaluating root project 'Utility'.
> Plugin with id 'com.jfrog.artifactory' not found.

我尝试用谷歌搜索这个错误,但没有找到任何有用的信息。有人可以帮我解决这个错误吗?我是 gradle.

的新手

谢谢。

在此处找到解决方案: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"

这与他们的构建脚本生成器生成的非常不同。希望这对其他人有帮助。