Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import tags without schemaLocation attribute result in FileNotFoundException #45

Open
andygoossens opened this issue Apr 1, 2019 · 6 comments

Comments

@andygoossens
Copy link

The plugin is unable to cope with import tags without a schemaLocation attribute. e.g.

<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>

If it encounters such tag, then the build will fail with a rather undescriptive error message:

Execution failed for task ':xsd-dependency-tree'.
> java.io.FileNotFoundException: /path/to/repo/gradle-jaxb-plugin-import-issue/src/main/resources/xsd (Is a directory)

I have created a simple testcase repository to reproduce this issue. While I can work around this issue by mentioning a schemaLocation attribute, I would rather avoid that. (The XSD files were copied from RFC 5730 and diverging from those would be undesirable.)

If I would be calling the Ant task XJC2Task directly, then I would have been able to provide a catalog file which it would use to understand how the namespaces and files fit together. Unfortunately, gradle-jaxb-plugin does not seem to support that. :-(

@wdschei
Copy link
Contributor

wdschei commented Apr 4, 2019

@andygoossens Is there a reason you can't pass it as an XJC argument (e.g. -catalog <file>?

Similar to this example:

https://github.com/rackerlabs/gradle-jaxb-plugin/blob/master/examples/hello-world-bindings-schema/hello-world-bindings-schema.gradle#L15

@andygoossens
Copy link
Author

I know I can pass it as a XJC argument, but the Gradle build will fail before reaching the "xjc" task. Task "xjc" depends on "xsd-dependency-tree" and it is the latter that fails.

I have tried excluding "xsd-dependency-tree", but that won't work either:

./gradlew clean xjc -x xsd-dependency-tree
> Task :xjc FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':xjc'.
> Cannot get property 'managedNodes' on null object

@drapej
Copy link

drapej commented Sep 19, 2019

@andygoossens : i have the same problem, did you find a solution ? Thank you

@andygoossens
Copy link
Author

@drapej: I am not using this plugin anymore for my module that has this error. I went back to using Ant task XJC2Task.

@drapej
Copy link

drapej commented Sep 19, 2019

@andygoossens : ok thank you. Is it possible to share your build.gradle with this ant task ?

@andygoossens
Copy link
Author

@drapej: I cannot share the actual code as it can be considered to be proprietary, but it looks like this:
https://stackoverflow.com/a/41880497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants