编译或构建Main项目时编译或构建Library的build.gradle文件

时间:2017-12-26 05:19:45

标签: android gradle android-gradle build.gradle

我有一个由我开发的库项目,在库中,在gradle文件中我提到了一个特定的任务,比如显示根项目和库项目路径。

现在当我将这个库添加到我的其他项目中时,当我构建项目时,我想构建Library gradle文件,以便它执行我在Library gradle文件中提到的任务。

该库中有一个库,我有一个插件,

// automatic code generation
apply plugin: 'jsonschema2pojo'

// automatic code generation
buildscript {
    repositories {
        jcenter()
        mavenLocal()

    }
    dependencies {
        classpath 'org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:0.5.1'
        //classpath 'org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:latest.integration'

    }
}

// automatic code generation
// Each configuration is set to the default value
jsonSchema2Pojo {
    generateBuilders = false
    usePrimitives = false
    source = files("${rootProject.projectDir}/schema/schema/")
    targetPackage = 'com.model'
    propertyWordDelimiters = [] as char[]
    useLongIntegers = false
    useDoubleNumbers = true
    includeHashcodeAndEquals = true
    includeToString = true
    annotationStyle = 'gson'
    customAnnotator = 'org.jsonschema2pojo.NoopAnnotator'
    includeJsr303Annotations = true
    sourceType = 'json'
    boolean removeOldOutput = true
    String outputEncoding = 'UTF-8'
    boolean useJodaDates = false
    boolean useCommonsLang3 = false
    boolean initializeCollections = true
} 

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    //  code generation
    compile 'org.glassfish:javax.annotation:10.0-b28'
    compile 'commons-lang:commons-lang:2.6'
    compile 'javax.validation:validation-api:1.1.0.CR2'

    testCompile 'junit:junit:4.12'
}

现在,我希望在将此库添加到其他项目时构建此代码或Gradle。

0 个答案:

没有答案