javagradlewsdlwsdl2java

Gradle wsdl generating


I want to generate java files from wsdl. I try to use wsdl2java gradle plugin. I define the plugin:

subprojects {
buildscript{
    repositories{
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'no.nils:wsdl2java:0.10'
    }
}


apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'application'
apply plugin: 'no.nils.wsdl2java'
....
}

but I got this error:

> Plugin with id 'no.nils.wsdl2java:no.nils:wsdl2java' not found.

I checked the syntax (many times it is good). I googled for the plugin, it is used by many people.

Does anybody have an idea what is going wrong?

Upd:

I have a main gradle where the plugins defined, and there are three sub project, where I want to use this plugin.

I defined the sub projects in the settings.gradle:

include 'project1', 'project2', 'project3'

I made a folder and the build.gradle file for each project.

If I commented out the apply plugin: 'no.nils.wsdl2java' in the main build.gradle and the wsdl2java methods in the sub projects the gradle works fine.


Solution

  • You add the buildscript inside the subprojects-closure, thats not supported, see this Gradle discussion (Buildscript {} in subprojects {} ignored?).

    You do not have to add the buildscript for every project, it is enough to just declare it on the root-build.gradle

    buildscript{
        repositories{
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath 'no.nils:wsdl2java:0.10'
        }
    }
    
    subprojects {
        apply plugin: 'java'
        apply plugin: 'eclipse'
        apply plugin: 'maven-publish'
        apply plugin: 'application'
        apply plugin: 'no.nils.wsdl2java'
        ....
    }