The project has a gradle module to build JAX2B classes. The XJC configuration already uses annotations:
bindingFiles = project.files("$projectDir/src/main/resources/binding.xjb",
"$projectDir/src/main/resources/annotations.xjb")
// Needed to execute custom annotations
options.add("-Xannotate")
}
I thought I could add options to get equals() and hashCode()
xjc {
bindingFiles = project.files("$projectDir/src/main/resources/binding.xjb",
"$projectDir/src/main/resources/annotations.xjb")
options.addAll("-Xannotate", "-Xequals", "-XhashCode")
}
The methods are not on the class and there are no errors or warnings in the build log. How do I generate those methods?
PS: Here are the build file dependencies
dependencies {
implementation(project(":xxx:xxx-api"))
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.2")
xjcPlugins("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.2")
xjcPlugins("org.jvnet.jaxb2_commons:jaxb2-basics-annotate:1.1.0")
}
UPDATED
Thanks to @thokuest for spotting a missing dependency.
The project has a gradle module to build JAX2B classes, but I'm getting build errors adding the "-Xequals" option:
build/generated/sources/xjc/java/org/pen/ProductOutputType.java:16: error: package org.jvnet.jaxb2_commons.locator.util does not exist
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
^
build/generated/sources/xjc/java/org/pen/ProductOutputType.java:47: error: cannot find symbol
public class ProductOutputType implements Equals2
^
I've created a minimum example as a gist -- build.gradle.kts