更新时间:2021-10-01 01:31:16
创建项目时不需要做任何特殊操作。 只需要一个简单的java项目。
You don't need to do anything special when you create your project. Just a simple java project will do.
但是有一些技巧可以帮到你。 jaxb有2个内置实时模板:
There are however some tricks that can help you. There are 2 built-in live templates for jaxb :
mjo
+ hit tab-key:将为编组人员生成代码。 ujo
+点击tab-key :将为unmarshaller生成代码。mjo
+ hit tab-key: will generate the code for a marshaller.ujo
+ hit tab-key: will generate the code for an unmarshaller. Intellij具有生成的内置功能任何
文件。只需右键单击任何 xml
文件的xsd xsd
文件,您将看到一个按钮从xml文件生成xsd架构。
Intellij has built-in functionality for generating an xsd
file for any xml
file. Just right-click on any xsd
file and you will see a button "Generate xsd schema from xml file".
JAXB还提供了一个工具( xjc.exe
)来生成JAXB代码存根。有一种简单的方法可以将此功能添加到IntelliJ。我更喜欢使用中的配置将 xsd
的按钮添加到java源代码转换外部工具菜单。
JAXB also offers a tool (xjc.exe
) to generate JAXB code stubs. There is a simple way to add this functionality to IntelliJ. I prefer to add a button for xsd
to java source conversion, using the configuration in the "External Tools" menu.
完成此配置后,您可以右键单击xsd文件,会出现一个按钮JAXB(XSD-> JAVA)。
After this configuration, you can right-click on an xsd file and there will be a button "JAXB (XSD->JAVA)".
注意:根据一些网站,还有一个用于生成jaxb存根的对话框/向导。但是,我还没有找到这个向导。也许它仅适用于最近的IntelliJ版本(14+),可能仅在商业版中,或者可能需要一些插件。 我的解决方案在IntelliJ 13.0.3 - 社区版中运行良好。
Note: According to some websites, there is also a dialog/wizard for generating jaxb stubs. However, I haven't found this wizard yet. Maybe it's only available in more recent IntelliJ versions (14+), maybe only in the commercial edition, or it may require some plugins. My solution works fine in IntelliJ 13.0.3 - Community Edition.