How do I create a JAXB project in IntelliJ IDEA 13?

I am learning JAXB. I need to know how to create a simple Java project for JAX-B in IntelliJ IDEA13. If anyone has an idea please update me and also update me with any plugin for IDEA

Thank.

+1


source to share


1 answer


You don't need to do anything when you build your project. Only a simple java project will do.

However, there are some tricks that can help you. There are two built-in live templates for jaxb :

  • type mjo

    + hit tab-key: will generate code for the marshaler.
  • typing ujo

    + hit tab-key: will generate code for unmarshaller.

Intellij has built-in functions to generate a filexsd

for any file xml

. Just right click on any file xsd

and you will see the button "Generate xsd schema from xml file".



JAXB also offers a tool ( xjc.exe

) for generating JAXB code snippets. There is an easy way to add this functionality to IntelliJ.
I prefer to add a button for xsd

in the Java source conversion using the configuration in the External Tools menu.

External tool configuration

After this configuration, you can right click on the xsd file and the "JAXB (XSD-> JAVA)" button will appear.

Note. According to some websites there is also a dialog / wizard for creating jaxb chunks. However, I haven't found this master yet. It may only be available in later versions of IntelliJ (14+), perhaps only in a commercial release, or some plugins may be required. My solution works great in IntelliJ 13.0.3 - Community Edition.

+4


source







All Articles