I have two Java projects that uses Gradle for building, Project A & Project B.
In Project A, the build.grade is using JaxB to generate Java classes from an XSD file. I am using the jacobono/gradle-jaxb-plugin which requires defining the XSD directory.
Project A
build.grade
jaxb {
xsdDir 'src/main/xsd'
...
If I run the build, Project A generates the Java classes and compiles fine.
For Project B, I want to use the Java generated classes in Project A so I added the project as a dependency.
Project B
settings.gradle
include ':project-a'
project(':project-a').projectDir = new File("../project-a")
build.grade
dependencies {
compile project(":project-a")
}
Now here is the problem, when I run the build for Project B, I get the following error:
> Directory 'C:\Users\xxxx\eclipse-workspace\project-b\src\main\xsd' specified for property 'schemasDirectory' does not exist. For some reason, it's using the Project B's directory as the root instead of Project A's which contains the XSD file.
My question is 1) Is there a way to avoid using Project B as the directory or 2) did I not structure my projects properly?