• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can the JAXB XJC compiler compile schemas that are in a jar file?

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been grappling with finding an answer to this for hours...on the surface it doesn't seem to work but maybe I'm doing it wrong. I have a jar file containing nothing but a directory structure full of various XSD files. I want to be able to use either the XJC.exe (with sun/oracle java 6) or the XJC Ant task to target and compile certain schemas out of this jar file without having to extract them. According to the documentation you are supposed to be able to supply an XSD file name or a URL or a directory containing one or more schemas or a jar file as the input to XJC. So far I can only get it to work when I extract the jar file contents and specify a specific XSD file or directory. That is not desirable. I have tried something like this (assuming the jar file is name 'myjarfile.jar'):

xjc myjarfile.jar

I get an error saying something like "no grammar was specified"

I try specifying as a URL...something like this:

xjc jar:file:/myjarfile.jar!/path/to/schemafile/targetschema.xsd

This just doesn't work as it appears not to be able to locate the schema this way. I have verified the path and jar file directory structures and I'm almost sure I didn't make a mistake in the path reference. Am I trying to do something that just wasn't meant to be here or am I just screwing it up somehow?

EDIT: I notice also it says that if you specify a jar file that /META-INF/sun-jaxb.episode will be compiled...however the jar file contains no such file and I cannot put one there since I am not allowed to modify the jar file contents. So am I out of luck...must this file be present to give a jar file of schemas to XJC or is it optional?
 
Alex Hurtt
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tried this again on a different computer and the method using:

xjc jar:file:/path/to/jarfile.jar!/path/to/targetschema.xsd

actually does work so...must be a configuration, bug, or version issue on the other machine.
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic