GeethanadhP / xml-avro

Convert XSD -> AVSC and XML -> AVRO
Apache License 2.0
36 stars 26 forks source link

How to run? #16

Closed clymbon closed 5 years ago

clymbon commented 5 years ago

Instructions say to build with gradle and then run "java -jar xml-avro.jar" However after running "gradle build", there is no xml-avro.jar created anywhere. There are two similar looking files:

./build/libs/xml-avro-1.7.15.jar ./build/libs/xml-avro-all-1.7.15.jar

Presumably it's one of those?

clymbon commented 5 years ago

Yes, looks like it's xml-avro-all-1.7.15. So this just requires a simple fix to the README.md. Or, even better, add something to the gradle build that spits out an executable run.sh file of the form:

#!/bin/bash
java -jar ./build/libs/xml-avro-all-1.7.15.jar $@
GeethanadhP commented 5 years ago

java -jar xml-avro.jar to run the code (options as below)

that is already there

clymbon commented 5 years ago

Actually that command does not work. The build does not create a file named xml-avro.jar

$ ls
build         example  gradle   gradlew.bat  README.md  settings.gradle
build.gradle  flight   gradlew  LICENSE      run.sh     src
duncant@bifo1.mitre.org ~/xml-avro$ java -jar xml-avro.jar
Error: Unable to access jarfile xml-avro.jar
duncant@bifo1.mitre.org ~/xml-avro$ find . -name xml-avro.jar -print
$

However, something like the following does work:

java -jar ./build/libs/xml-avro-all-1.7.15.jar

Also, some more documentation on how to run the code would be really helpful. For example, I have managed to convert my XML schema (Flight.xsd) to an Avro schema (Flight.avsc). Now I'm trying to convert an XML file (flight.xml) to an avro file (flight.avro), while validating against the schema. My attempt to do that is:

$ java -jar /path/to/jar/file/xml-avro-all-1.7.15.jar --toAvro Flight.avsc flight.xml --validateSchema Flight.xsd
Exception in thread "main" in.dreamlabs.xmlavro.ConversionException: XML Input is not specified in the config
    at in.dreamlabs.xmlavro.config.XMLConfig.validate(Config.scala:153)
    at in.dreamlabs.xmlavro.config.Config.validate(Config.scala:48)
    at in.dreamlabs.xmlavro.config.ConfigParser.<init>(ConfigParser.scala:25)
    at in.dreamlabs.xmlavro.config.ConfigParser$.apply(ConfigParser.scala:113)
    at in.dreamlabs.xmlavro.Converter$.main(Converter.scala:42)
    at in.dreamlabs.xmlavro.Converter.main(Converter.scala)

However, as you can see, that does not work. The error message is confusing - I did specify an XML file, and I did not specify a config file, so why is it saying there is no XML input, and what "config" is it referring to? Do I need to specify a config file? When I use a config.yml file, following the example provided, it does BOTH the xsd conversion and then the xml conversion.

GeethanadhP commented 5 years ago

sorry about that please use the config file, there were a lot of changes but none of them are made to the command line, so command line is not working

check https://github.com/roycem90/xml-avro/blob/master/example/config.yml for sample config i will update the readme alslo