# Generate Java code from multiple wsdls using gradle

**URL:** https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195
**Category:** Help/Discuss
**Created:** [June 1, 2018, 7:45am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195 "2018-06-01T07:45:20Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 1, 2018, 7:45am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/1 "2018-06-01T07:45:21Z")

</div>

I am migrating from maven to gradle. I started with gradle in it which generated couple of gradle files with a lot of dependencies into build.gradle. However, I did not get any entry of the wsdls to generate java code using wsdl2code plugin. Any suggestions?[pom.xml](https://discuss.gradle.org/uploads/short-url/sWweCL5dmcNwspt57PcBrxXPaev.xml) (16.4 KB)

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 3, 2018, 7:52am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/2 "2018-06-03T07:52:06Z")

</div>

You could use [the ant task](https://axis.apache.org/axis2/java/core/tools/CodegenToolReference.html#ant) and Gradle’s [ant integration](https://docs.gradle.org/current/userguide/ant.html)

eg

```gradle
apply plugin: java
ext {
    wsdlDir = 'src/main/wsdl'
}
configurations {
    axis
}
dependencies {
    axis 'org.apache.axis2:axis2-ant-plugin:1.7.8'
}
task generateCode {
   inputs.dir wsdlDir
   outputs.dir "$buildDir/codegen"
   doLast {
      ant.taskdef(
         name: 'codegen', 
         classname: 'org.apache.axis2.tool.ant.AntCodegenTask', 
         classpath: configurations.axis.asPath 
      )
      ant.codegen(
         wsdlfilename:"$wsdlDir/OfferCodeService-v5.wsdl",
         output: "$buildDir/codegen"
      )
      ant.codegen(    
         wsdlfilename:"$wsdlDir/ProductOfferingService_v11.wsdl",
         output: "$buildDir/codegen",
         syncOnly: 'true'
      )
      // etc
   }
}
compileJava.dependsOn generateCode
sourceSets.main.java.srcDir "$buildDir/codegen"

```

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 7:15am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/3 "2018-06-04T07:15:53Z")

</div>

Still getting compilation errors, unable to figure out… There is nothing in my gradle above which is executing at runtime except junit. Can you please suggest.

buildscript {  
repositories { mavenCentral() }  
// dependencies { classpath(“org.springframework.boot:spring-boot-gradle-plugin:1.1.7.RELEASE”) }  
}

apply plugin: ‘java’  
apply plugin: ‘maven’  
apply plugin: ‘application’  
apply plugin: ‘intellij’

//defaultTasks ‘clean’, ‘build’

group = ‘com.guftgupoint.data’  
version = ‘8.7.1.30-SNAPSHOT’

description = “Guftgu-Trunk”

//default wsdl directory path  
def wsdlDir = file(new File(‘src/main/wsdl’))  
def buildDir = file(new File(‘target/generated-sources/axis2’))

task wrapper(type: Wrapper) {  
gradleVersion = ‘2.13’  
}

sourceCompatibility = 1.7  
targetCompatibility = 1.7

jar { baseName = ‘guftgu’ }

configurations {  
compile  
runtime  
axisGenAntTask  
}

repositories {

```
maven { url "http://it-maven.guftgupoint.com/content/repositories/m2repo-snapshots" }
maven { url "http://it-maven/content/groups/m2repo/" }
maven { url "http://repo.maven.apache.org/maven2" }

```

}  
dependencies {  
compile group: ‘org.springframework’, name: ‘spring-context’, version:‘3.1.1.RELEASE’  
compile group: ‘org.springframework’, name: ‘spring-context-support’, version:‘3.1.1.RELEASE’  
compile(group: ‘org.springframework’, name: ‘spring-core’, version:‘3.1.1.RELEASE’)  
{  
exclude(module: ‘commons-logging’)  
}  
compile group: ‘org.springframework’, name: ‘spring-jdbc’, version:‘3.1.1.RELEASE’  
compile group: ‘org.springframework’, name: ‘spring-orm’, version:‘3.1.1.RELEASE’  
compile group: ‘com.ibatis’, name: ‘ibatis’, version:‘2.3.0’  
compile group: ‘commons-lang’, name: ‘commons-lang’, version:‘2.4’  
compile group: ‘commons-collections’, name: ‘commons-collections’, version:‘3.2.2’  
compile group: ‘commons-logging’, name: ‘commons-logging’, version:‘1.2’  
compile(group: ‘com.ami.sed’, name: ‘keyvalueutil’, version:‘1.7’)  
{  
exclude(module: ‘commons-lang’)  
exclude(module: ‘slf4j-api’)  
}  
compile group: ‘aspectj’, name: ‘aspectjweaver’, version:‘1.5.3’  
compile group: ‘org.apache.axis2’, name: ‘axis2’, version:‘1.7.3’  
compile(group: ‘org.apache.axis2’, name: ‘axis2-codegen’, version:‘1.7.3’)  
{  
exclude(module: ‘commons-logging’)  
}  
compile(group: ‘org.apache.ws.commons.axiom’, name: ‘axiom-impl’, version:‘1.2.19’)  
{  
exclude(module: ‘geronimo-javamail\_1.4\_spec’)  
exclude(module: ‘geronimo-activation\_1.1\_spec’)  
}  
compile group: ‘xml-apis’, name: ‘xml-apis’, version:‘1.3.04’  
compile(group: ‘com.dish.dishlayer’, name: ‘dishlayerChecksumUtility’, version:‘1.2’)  
{  
exclude(module: ‘spring’)  
exclude(module: ‘commons-collections’)  
exclude(module: ‘commons-logging’)  
}  
compile(group: ‘org.apache.axis2’, name: ‘axis2-kernel’, version:‘1.7.3’)  
{  
exclude(module: ‘commons-logging’)  
exclude(module: ‘commons-codec’)  
exclude(module: ‘wstx-asl’)  
exclude(module: ‘commons-io’)  
}  
compile group: ‘javax.activation’, name: ‘activation’, version:‘1.1’  
compile group: ‘backport-util-concurrent’, name: ‘backport-util-concurrent’, version:‘3.1’  
compile group: ‘commons-codec’, name: ‘commons-codec’, version:‘1.3’  
compile(group: ‘commons-configuration’, name: ‘commons-configuration’, version:‘1.6’)  
{  
exclude(module: ‘commons-logging’)  
exclude(module: ‘commons-collections’)  
}  
compile(group: ‘net.sf.ehcache’, name: ‘ehcache-core’, version:‘2.6.2’)  
{  
exclude(module: ‘slf4j-api’)

```
}
compile(group: 'org.apache.axis2', name: 'axis2-fastinfoset', version:'1.7.3') 
{
	exclude(module: 'commons-logging')
	exclude(module: 'httpcore')
	exclude(module: 'commons-codec')
}
compile group: 'quartz', name: 'quartz', version:'1.6.6'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.6.4'
runtime group: 'log4j', name: 'log4j', version:'1.2.16'
testCompile group: 'junit', name: 'junit', version:'4.8.1'
testCompile group: 'commons-dbcp', name: 'commons-dbcp', version:'1.4'
testCompile group: 'oracle', name: 'classes12', version:'9.1'
testCompile group: 'javax.transaction', name: 'jta', version:'1.0.1B'
compile(group: 'weblogic', name: 'weblogic', version:'8.1.4.0')
//	compile(group: 'org.apache.axis2', name: 'axis2-wsdl2code-maven-plugin', version: '1.6.2'){
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
 This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
 Please review and delete this closure when resolved. */
axisGenAntTask 'org.apache.axis2:axis2-ant-plugin:1.7.8'

```

}

task generateCode {  
// inputs.dir wsdlDir  
// outputs.dir “$buildDir/codegen”  
doLast {  
ant.taskdef(  
name: ‘codegen’,  
classname: ‘org.apache.axis2.tool.ant.AntCodegenTask’,  
classpath: configurations.axisGenAntTask.asPath  
)  
ant.codegen(  
wsdlfilename:"$wsdlDir/OfferCodeService-v5.wsdl",  
output: “$buildDir/codegen”  
)  
ant.codegen(  
wsdlfilename:"$wsdlDir/ProductOfferingService\_v11.wsdl",  
output: “$buildDir/codegen”,  
syncOnly: ‘true’  
)  
ant.codegen(  
wsdlfilename:"$wsdlDir/ProgrammingService-v11.wsdl",  
output: “$buildDir/codegen”  
)   
}  
}

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 8:15am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/4 "2018-06-04T08:15:44Z")

</div>

1. You haven’t included the error so I can’t help
2. Don’t create a variable named `buildDir` as it will be confused/conflict with `project.buildDir`
3. Don’t generate code under `target` directory, generate under `build` directory (`project.buildDir`) so it gets cleaned by the `clean` task
4. Better to define `wsdlDir` in the `ext { ... }` block as in my example

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 8:47am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/5 "2018-06-04T08:47:10Z")

</div>

Thanks for the suggession, the error is mentioned below, it seems the xsds are not compiled due to which it is showing the objects not found OR stub not generated.

D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:12: error: package com.aminetwork.www.xsd.productchannellineuptype.\_2009\_09\_20 does not exist  
import com.aminetwork.www.xsd.productchannellineuptype.\_2009\_09\_20.ProductChannelLineupType;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:13: error: package com.aminetwork.www.xsd.productstationservicedata.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicedata.\_2010\_12\_01.ProductAndChannel;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:14: error: package com.aminetwork.www.xsd.productstationservicedata.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicedata.\_2010\_12\_01.RsNetDataType;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:15: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProductStationByProductIdRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:16: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProductStationByProductIdResponse;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:17: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProductStationChannelLineupRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:18: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProductStationChannelLineupResponse;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:19: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProductStationRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:20: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProductStationResponse;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:21: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProgrammingProductByChannelRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:22: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveProgrammingProductByChannelResponse;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:23: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveRsNetRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:24: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveRsNetResponse;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:25: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveSpotBeamsRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:26: error: package com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01 does not exist  
import com.aminetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveSpotBeamsResponse;

D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:27: error: package com.aminetwork.www.xsd.programmingproduct.\_2009\_09\_20 does not exist  
import com.aminetwork.www.xsd.programmingproduct.\_2009\_09\_20.ProgrammingProduct;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:28: error: package com.guftgupoint.axis2 does not exist  
import com.guftgupoint.axis2.ProductStationServiceFaultMsg;  
^  
D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\dataservice\ProductStationDataService.java:29: error: package com.guftgupoint.axis2 does not exist  
import com.guftgupoint.axis2.ProductStationService\_v3\_0Stub;  
^  
Note: D:\java\_projects\US67132\src\main\java\com\guftgupoint\data\impl\cache\EhCacheImpl.java uses or overrides a deprecated API.  
Note: Recompile with -Xlint:deprecation for details.  
Note: Some input files use unchecked or unsafe operations.  
Note: Recompile with -Xlint:unchecked for details.  
100 errors  
:compileJava FAILED

FAILURE: Build failed with an exception.

- What went wrong:  
Execution failed for task ‘:compileJava’.

> Compilation failed; see the compiler error output for details.

- Try:  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 8:56am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/6 "2018-06-04T08:56:25Z")

</div>

I think you missed these bits

```gradle
compileJava.dependsOn generateCode
sourceSets.main.java.srcDir "$buildDir/codegen" 

```

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 9:42am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/7 "2018-06-04T09:42:04Z")

</div>

## Same issue even after adding the last two lines. This is where I have added them in build.gradle

…  
ant.codegen(  
wsdlfilename:“$wsdlDir/DishNetWirelineService.wsdl”,  
output: “$buildDir/codegen”  
)  
ant.codegen(  
wsdlfilename:“$wsdlDir/PreBuiltCommitmentService-v1.wsdl”,  
output: “$buildDir/codegen”  
)  
compileJava.dependsOn generateCode  
sourceSets.main.java.srcDir “$buildDir/codegen”  
}  
}

* * *

I think the xsds are not getting converted to corresponding java classes. Is it because of the package name missing in the pom (which had below entry)

* * *

```
			<groupId>org.apache.axis2</groupId>
			<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
			<version>1.6.2</version>
			<configuration>
				<outputDirectory>target/generated-sources/axis2</outputDirectory>
				<packageName>com.echostar.axis2</packageName>
				<unpackClasses>true</unpackClasses>
				<options>
					<property>
						<name>osv</name>
						<value>osv</value>
					</property>
				</options>
			</configuration>
			<executions>
				<execution>
					<id>OfferCodeService</id>
					<goals>
						<goal>wsdl2code</goal>
					</goals>
					<configuration>
						<wsdlFile>${wsdl.dir}OfferCodeService-v5.wsdl</wsdlFile>
					</configuration>
				</execution>

```

* * *

## Latest Error

1 does not exist  
import com.dishnetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveSpotBeamsRequest;  
^  
D:\java\_projects\US67132\src\main\java\com\echostar\data\dataservice\ProductStationDataService.java:26: error: package com.dishnetwork.www.xsd.productstationservicemessage.\_2010\_12\_0  
1 does not exist  
import com.dishnetwork.www.xsd.productstationservicemessage.\_2010\_12\_01.RetrieveSpotBeamsResponse;  
^  
D:\java\_projects\US67132\src\main\java\com\echostar\data\dataservice\ProductStationDataService.java:27: error: package com.dishnetwork.www.xsd.programmingproduct.\_2009\_09\_20 does not  
exist  
import com.dishnetwork.www.xsd.programmingproduct.\_2009\_09\_20.ProgrammingProduct;  
^  
D:\java\_projects\US67132\src\main\java\com\echostar\data\dataservice\ProductStationDataService.java:28: error: package com.echostar.axis2 does not exist  
import com.echostar.axis2.ProductStationServiceFaultMsg;  
^  
D:\java\_projects\US67132\src\main\java\com\echostar\data\dataservice\ProductStationDataService.java:29: error: package com.echostar.axis2 does not exist  
import com.echostar.axis2.ProductStationService\_v3\_0Stub;  
^  
Note: D:\java\_projects\US67132\src\main\java\com\echostar\data\impl\cache\EhCacheImpl.java uses or overrides a deprecated API.  
Note: Recompile with -Xlint:deprecation for details.  
Note: Some input files use unchecked or unsafe operations.  
Note: Recompile with -Xlint:unchecked for details.  
100 errors  
:compileJava FAILED

FAILURE: Build failed with an exception.

- What went wrong:  
Execution failed for task ‘:compileJava’.

> Compilation failed; see the compiler error output for details.

- Try:  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 17.189 secs

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 9:55am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/8 "2018-06-04T09:55:29Z")

</div>

No, put the lines at the top level, outside the task definition, as in my example

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 10:13am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/9 "2018-06-04T10:13:42Z")

</div>

It is same error ☹  
ant.codegen(  
wsdlfilename:"$wsdlDir/PreBuiltCommitmentService-v1.wsdl",  
output: “$buildDir/codegen”  
)  
}  
}  
compileJava.dependsOn generateCode  
sourceSets.main.java.srcDir “$buildDir/codegen”

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 10:43am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/10 "2018-06-04T10:43:33Z")

</div>

What happens when you run

`gradle generateCode`

Are the java files under `build/codegen`?

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 10:48am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/11 "2018-06-04T10:48:08Z")

</div>

Yes they are getting generated at the location you’ve mentioned. In fact the issue seems to me is java files corresponding to xsd is not getting generated.

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 10:53am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/12 "2018-06-04T10:53:53Z")

</div>

Ok, I’m guessing that’s another maven plugin that needs to be migrated to gradle?

Also, I noted that you commented this out

```gradle
inputs.dir wsdlDir
outputs.dir "$buildDir/codegen"

```

If you put this back you can benefit from faster builds when the wsdls have not changed

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 10:58am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/13 "2018-06-04T10:58:52Z")

</div>

I have uncommented them already, but sent you old one

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 11:11am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/14 "2018-06-04T11:11:51Z")

</div>

Ok, so looks like your wsdl code gen issue is now resolved. Now you have a similar xsd issue (guessing there’s an ant task for that too)

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 11:18am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/15 "2018-06-04T11:18:03Z")

</div>

Yes, How about adding below code in every ant.codegen block  
ant.codegen(  
wsdlfilename:"$wsdlDir/TechstoreDataService.wsdl",  
databindingName: ‘adb’,  
allPorts: ‘true’,  
overWrite: ‘true’,  
output: “$buildDir/codegen”,  
unpackClasses: ‘true’  
)  
ant.codegen(  
wsdlfilename:"$wsdlDir/DishNetWirelineService.wsdl",  
databindingName: ‘adb’,  
allPorts: ‘true’,  
overWrite: ‘true’,  
output: “$buildDir/codegen”,  
unpackClasses: ‘true’  
)  
ant.codegen(  
wsdlfilename:"$wsdlDir/PreBuiltCommitmentService-v1.wsdl",  
databindingName: ‘adb’,  
allPorts: ‘true’,  
overWrite: ‘true’,  
output: “$buildDir/codegen”,  
unpackClasses: ‘true’  
)  
}  
}  
compileJava.dependsOn generateCode  
sourceSets.main.java.srcDir “$buildDir/codegen”

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 11:32am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/16 "2018-06-04T11:32:01Z")

</div>

After making the above changes I am getting xsd corresponding code generated, but now getting below mentioned error:

Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/Image/2009\_09\_20](http://www.aminetwork.com/xsd/Image/2009_09_20)}Image’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/DiscountCode/2009\_09\_20](http://www.aminetwork.com/xsd/DiscountCode/2009_09_20)}DiscountCode’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/AcquisitionChannel/2009\_09\_20](http://www.aminetwork.com/xsd/AcquisitionChannel/2009_09_20)}AcquisitionChannel’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/TargetMarket/2011\_10\_14](http://www.aminetwork.com/xsd/TargetMarket/2011_10_14)}TargetMarket’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/GeographicalLocation/2009\_09\_20](http://www.aminetwork.com/xsd/GeographicalLocation/2009_09_20)}GeographicalLocation’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/Image/2009\_09\_20](http://www.aminetwork.com/xsd/Image/2009_09_20)}Image’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/DPAttributes/2009\_09\_20](http://www.aminetwork.com/xsd/DPAttributes/2009_09_20)}DPAttributes’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/DiscountCode/2009\_09\_20](http://www.aminetwork.com/xsd/DiscountCode/2009_09_20)}DiscountCode’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/BillingOffer/2009\_09\_20](http://www.aminetwork.com/xsd/BillingOffer/2009_09_20)}BillingOffer’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/AbstractProduct/2009\_09\_20](http://www.aminetwork.com/xsd/AbstractProduct/2009_09_20)}AbstractProduct’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/EPG/2009\_09\_20](http://www.aminetwork.com/xsd/EPG/2009_09_20)}EPG’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/Station/2009\_09\_20](http://www.aminetwork.com/xsd/Station/2009_09_20)}Station’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/OrbitalLocation/2009\_09\_20](http://www.aminetwork.com/xsd/OrbitalLocation/2009_09_20)}OrbitalLocation’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/Beam/2009\_09\_20](http://www.aminetwork.com/xsd/Beam/2009_09_20)}Beam’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/ChannelLineup/2009\_09\_20](http://www.aminetwork.com/xsd/ChannelLineup/2009_09_20)}ChannelLineup’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/GeographicalLocation/2009\_09\_20](http://www.aminetwork.com/xsd/GeographicalLocation/2009_09_20)}GeographicalLocation’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/Image/2009\_09\_20](http://www.aminetwork.com/xsd/Image/2009_09_20)}Image’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/DPAttributes/2009\_09\_20](http://www.aminetwork.com/xsd/DPAttributes/2009_09_20)}DPAttributes’  
Could not find any schema type associated with the Element ‘{[http://www.aminetwork.com/xsd/DiscountCode/2009\_09\_20](http://www.aminetwork.com/xsd/DiscountCode/2009_09_20)}DiscountCode’

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 11:41am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/17 "2018-06-04T11:41:10Z")

</div>

Note: you can use a list to reduce the code. Eg:

```gradle
['a.wsdl', 'b.wsdl', 'c.wsdl'].each { wsdl ->
   ant.codegen(
      wsdlfilename:"$wsdlDir/$wsdl",
      databindingName: ‘adb’,
      // etc
   ) 
}

```

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 4, 2018, 12:13pm UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/18 "2018-06-04T12:13:24Z")

</div>

Thanks Lance, but what about the build failure, although I am getting the java code corresponding to xsd getting generated. Any thoughts OR shall I move to wsd2java plugin.

---

<div class="post-metadata">

### Author: ![Lance](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance/32/787_2.png) [@Lance](https://discuss.gradle.org/u/Lance)
#### Post date: [June 4, 2018, 1:40pm UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/19 "2018-06-04T13:40:23Z")

</div>

I’m not familiar with axis codegen and was just trying to get you started. You’ll have to do your own investigation from here.

Perhaps you’ve got another plugin in your maven build which generates java from xsd? In which case you’ll need to do the same in the Gradle build.

Or perhaps the Maven codegen plugin sets some defaults which aren’t set by default when using the ant task? A poke through the [codegen Maven plugin code](https://github.com/apache/axis2-java/tree/329ac88407e73d63c1831c85a1228abc588d8f39/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code) might help

---

<div class="post-metadata">

### Author: ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)
#### Post date: [June 5, 2018, 7:59am UTC](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195/20 "2018-06-05T07:59:39Z")

</div>

Thank you  
Is this what you said, how about syncOnly : ‘true’ only for second wsdl??

task generateCode {  
inputs.dir wsdlDir  
outputs.dir “$buildDir/codegen”  
doLast {  
ant.taskdef(  
name: ‘codegen’,  
classname: ‘org.apache.axis2.tool.ant.AntCodegenTask’,  
classpath: configurations.axisGenAntTask.asPath  
)  
[‘OfferCodeService-v5.wsdl’, ‘ProductOfferingService\_v11.wsdl’, ‘ProgrammingService-v11.wsdl’, ‘billingMapperService-v13.wsdl’, ‘RetrieveLocationService-v2.wsdl’, ‘RetrieveEquipmentsService-v3.wsdl’, ‘ProductStationService-v3.wsdl’, ‘PricerService-v1.wsdl’, ‘NetqualService-v3.wsdl’, ‘EquipmentsInfoService.wsdl’, ‘DistributeRulesService.wsdl’, ‘distributeEPCProjectWS.wsdl’, ‘ServiceCodeCategoryLookupService-v3.wsdl’, ‘AppPropertyKeyValueService.wsdl’, ‘TechstoreDataService.wsdl’, ‘DishNetWirelineService.wsdl’, ‘PreBuiltCommitmentService-v1.wsdl’].each { wsdl -\>  
ant.codegen(  
“$wsdlDir/$wsdl”,  
databindingName: ‘adb’,  
allPorts: ‘true’,  
overWrite: ‘true’,  
output: ‘$buildDir/codegen’,  
unpackClasses: ‘true’  
)  
}  
}  
}  
compileJava.dependsOn generateCode  
sourceSets.main.java.srcDir “$buildDir/codegen”

[Next page](https://discuss.gradle.org/t/generate-java-code-from-multiple-wsdls-using-gradle/27195.md?page=2)
