Compile or build Library's build.gradle file when we compile or build Main project

Hello All,

Can anyone help me to solve this question?

I am having one Library Project which is developed by me, inside Library, in gradle file I have mentioned one specific task, like show the root project and library project path.

Now when I am adding this Library to my other project and when I build the project, I wanted to build the Library gradle file so that it performs the task which I have mentioned in Library gradle file.

there is one library inside that library, I have one plugin,

// 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'
}

now, I want this code or Gradle to build while I add this library to my other project.

let me know if you need more information.

Thanks
Madhav

Is this a multi project build with two subprojects, or are they two separate projects?

Hi Charis,

Let me explain that,

there is one library inside that library, I have one plugin,

// 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'
}

now, I want this code or Gradle to build while I add this library to my other project.

let me know if you need more information.

Thanks
Madhav