stoicflame / enunciate-gradle

Gradle plugin for Enunciate
Apache License 2.0
5 stars 4 forks source link

How to configure multiple enunciate tasks in Gradle in Groovy format? #31

Open nithinbandaru1 opened 1 year ago

nithinbandaru1 commented 1 year ago

Hi here is the configuration done in build.gradle file

buildscript {
    ext {
        enunciateVersion = '2.14.0'
    }
}

plugins {
    id "com.webcohesion.enunciate" version "${enunciateVersion}"
}

apply plugin: 'com.webcohesion.enunciate'

configure(enunciate) {
    group 'documentation'
    description 'Generates web service API documentation using Enunciate.'
}

dependencies {
    compileOnly group: 'com.webcohesion.enunciate', name: 'enunciate-core-annotations', version: enunciateVersion
}

task enunciateModule1(type: com.webcohesion.enunciate.gradle.EnunciateTask) {
    def enunciateDistDir = file('build/docs1/javadoc/api')

   doFirst {
        enunciateDistDir.deleteDir()
        enunciateDistDir.mkdirs()
    }

    export('docs1', enunciateDistDir)
    configFileName = 'enunciate.xml'
}

task enunciateModule2(type: com.webcohesion.enunciate.gradle.EnunciateTask) {
    def enunciateDistDir = file('build/docs2/javadoc/api')

    doFirst {
        enunciateDistDir.deleteDir()
        enunciateDistDir.mkdirs()
    }

    export('docs2', enunciateDistDir)
    configFileName = 'enunciate2.xml'
}

It throws error saying

Cannot invoke "org.gradle.api.artifacts.Configuration.getFiles()" because "this.enunciateModuleConfiguration" is null

But when I define the task inside publishing block it works but it can have only one enunciate task

publishing {
    repositories { flatDir { dirs 'build/archive' } }
    tasks.enunciate {
        File enunciateDistDir = file("build/docs1/javadoc/api")
        doFirst {
            enunciateDistDir.deleteDir()
            enunciateDistDir.mkdirs()
        }
        export("docs", enunciateDistDir)
        configFileName = "enunciate.xml"
    }
}

Please help me to get this fixed

stoicflame commented 1 year ago

I'm afraid I'm not a Gradle user so I'm not sure I have much to help here. Hoping someone from the community could help? Or you may need to debug it yourself?

nithinbandaru1 commented 1 year ago

@stoicflame Do you get any idea on this property this.enunciateModuleConfiguration. Is it part of enunciate or its not. If in case it is I would configure it, if you point to the information regarding it.

stoicflame commented 1 year ago

Are you talking about this one?

Again, I'm afraid I didn't develop this plugin myself so I don't know much about it. It's a Gradle configuration class, so I'd have to dig into the docs to figure out what it's doing.

nithinbandaru1 commented 1 year ago

@stoicflame Yes, at-least you pointed to the right thing. Thanks for that. Some how build.gradle is not providing enough details for this plugin. It's something to do with the Gradle config itself. I know you are not a Gradle user. I don't see any one in community actually participating except you. I will have a look at it and see if I can figure out something being a .NET developer who is exploring some java project 😃

Anyway, Thanks for the help by far.