Varun Sharma
Varun Sharma

Reputation: 21

How to use Gradle plugins from https://plugins.gradle.org/search?term=wsdl2java

I have a project with wsdl files and want to generate java classes from them using gradle. Came across this link and tried every possible way to configure the plugin within my project.

PS: I am new to Gradle :-)

When entering the plugin using plugin DSL technique

plugins {
  id "com.github.bjornvester.wsdl2java" version "1.2"
}

it throws me off with the plugin not found

and if using the legacy plugin application technique it throws off with

HttpRequestException with could not GET 'https://plugins.gradle.org/m2/gradle/plugin/bjornvester/wsdl2java-gradle-plugin/1.2/wsdl2java-gradle-plugin-1.2.pom'

The server may not support the client's requested TLS protocolversions:(TLSv1.2).

It asks me to configure the client to allow other protocols to be used and routes me to the link:
https://docs.gradle.org/current/userguide/build_environment.html

In the entire article I referred to configuring the System properties

systemProp.gradle.https.protocols=TLSv1.2,TLSv1.3 

in the root gradle-wrapper.properties file, but still throws me off with same error.

Questions:

  1. Where am I going wrong?
  2. How can I configure the plugins from https://plugins.gradle.org/search?term=wsdl2java within my gradle build project.
  3. How and where should I configure the plugins? settings.gradle or gradle build?

Upvotes: 0

Views: 379

Answers (2)

Ismail
Ismail

Reputation: 1948

you can write code like this in your gradle.build latest version now i think 2.0.2

link to the version

link to source code if you want version 1.2

but better if you go with the latest

plugins {
  id 'com.github.bjornvester.wsdl2java' version '1.2'
}

or

plugins {
  id("com.github.bjornvester.wsdl2java") version "2.0.2"
}

repositories {
    mavenCentral()
 // you can use local network nexus of already download the old one
    maven { url 'https://localnexus' }
    }

wsdl2java{
// here you override or define the location to wsdls folder where you put your wsdls files  
    wsdlDir = file("$projectDir/src/main/resources")
}

Upvotes: 0

Varun Sharma
Varun Sharma

Reputation: 21

Paraphrasing the actual issue I was facing, was trying to access wsdl2java plugin from io.mateo.cxf-codegen

Was not able to download the plugin directly from Gradle Repo since working via VDI, that's why was facing the earlier challenge.

Organization VDI would restrict access to open-source plugins and would throw error/issues related to TLS or security certificates.

Workaround: Accessed the jar along with POM files from https://plugins.gradle.org/m2/io/ and placed them into the central repo.

Customized the script in the corresponding build.gradle file where you want to use the plugin.

 buildscript {
    repositories {
        maven{
               url : "<central_repo_url>"
               credentials{
                 username:<--username-->
                  password:<--password-->
               }
        }
    }
    dependencies {
        classpath group:'io.mateo' name:'cxf-codegen-gradle' version:1.2.1
    }
}
apply plugin: 'io.mateo.cxf-codegen'

Note: One might have to change the classpath name based on the dependencies stored within your organization's central repo.

Ran the script and was able to access the dependencies.

Hope this helps

That's all Folks.........

Upvotes: 0

Related Questions