# Using jaxb2-annotate-plugin with Gradle XJC plugin

**URL:** <https://discuss.gradle.org/t/using-jaxb2-annotate-plugin-with-gradle-xjc-plugin/32702>\
**Category:** Help/Discuss\
**Created:** [August 6, 2019, 8:35pm UTC](https://discuss.gradle.org/t/using-jaxb2-annotate-plugin-with-gradle-xjc-plugin/32702 "2019-08-06T20:35:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjparme](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@mjparme](https://discuss.gradle.org/u/mjparme)\
**Post date:** [August 6, 2019, 8:35pm UTC](https://discuss.gradle.org/t/using-jaxb2-annotate-plugin-with-gradle-xjc-plugin/32702/1 "2019-08-06T20:35:36Z")

</div>

We are using this plugin to generate code from XSD and WSDL’s:

> **[GitHub - unbroken-dome/gradle-xjc-plugin: A Gradle plugin to run the XJC...](https://github.com/unbroken-dome/gradle-xjc-plugin)**
>
> A Gradle plugin to run the XJC binding compiler during a build - GitHub - unbroken-dome/gradle-xjc-plugin: A Gradle plugin to run the XJC binding compiler during a build

In addition to the normal code generation we need annotations added to the generated sources. I am trying to use the XJC plugin jaxb2-annotate-plugin to accomplish this.

The gradle XJC plugin has some vague documentation for loading XJC plugins here: [GitHub - unbroken-dome/gradle-xjc-plugin: A Gradle plugin to run the XJC binding compiler during a build](https://github.com/unbroken-dome/gradle-xjc-plugin#specifying-the-plugin-classpath)

Through that doc, some SO posts and other general searching I pieced together this build.gradle:

> configurations {  
> xjcClasspath  
> }
> 
> dependencies {  
> xjcClasspath “org.jvnet.jaxb2\_commons:jaxb2-basics-annotate:jar:1.0.3”  
> xjcClasspath “org.jvnet.jaxb2\_commons:jaxb2-basics-tools:jar:0.8.1”  
> xjcClasspath “org.jvnet.jaxb2\_commons:jaxb2-basics:1.11.1”  
> xjcClasspath “org.jvnet.annox:annox:1.0.1”  
> xjcClasspath “com.github.javaparser:javaparser-core:1.0.11”  
> xjcClasspath “commons-io:commons-io:jar:1.2”  
> xjcClasspath “commons-beanutils:commons-beanutils:1.7.0”  
> xjcClasspath “commons-logging:commons-logging:1.1.1”  
> xjcClasspath “org.apache.commons:commons-lang3:3.9”  
> }

On my `xjcGenerate` task config I am adding `extraArgs = ["-Xannotate"]` (this is supposed to activate the jaxb2-annotate-plugin for XJC).

However, no matter what I do I get the error:

> Execution failed for task ‘:xjcGenerate’.  
> com.sun.tools.xjc.BadCommandLineException: unrecognized parameter -Xannotate

I assume the jaxb2-annotate-plugin for XJC isn’t getting loaded. I am wondering if someone has this working in their gradle build and can provide an example?
