Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nithinbandaru1 opened this issue Mar 7, 2023 · 4 comments

Comments

@nithinbandaru1
Copy link

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
Copy link
Owner

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
Copy link
Author

@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
Copy link
Owner

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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants