我如何访问gradle buildscript块中的变量

时间:2017-01-31 21:58:41

标签: gradle

我正在使用此插件https://plugins.gradle.org/plugin/nu.studer.credentials来加密我的私有nexus存储库的用户名和密码。

Buildscript块看起来像这样

    buildscript {
    repositories {
        jcenter()
        mavenCentral()

        maven {
            url "http://my.privaterepo.com/nexus/content/repositories/snapshots"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
        classpath 'nu.studer:gradle-credentials-plugin:1.0.1'
        classpath 'com.private.plugin:Pipeline:0.4.0-SNAPSHOT'
    }
}
apply plugin: 'nu.studer.credentials'

project.ext.usrname = credentials.uname
project.ext.passwd = credentials.passwd

要访问我的私人关系,我需要将用户名和密码传递给 maven 。我怎样才能实现使用插件,即使在插件初始化之前,也考虑使用buildscript块。

我的最终目标是在任何文件中都没有将用户名和密码保存为明文。任何其他想法也欢迎。

0 个答案:

没有答案
相关问题