简体   繁体   English

IntelliJ无法识别JAXB类的导入语句

[英]IntelliJ doesn't recognize import statements for JAXB classes

I'm using IntelliJ IDEA 14 as IDE and jaxb2-maven-plugin for creating Java classes from XSD files. 我使用IntelliJ IDEA 14作为IDE和jaxb2-maven-plugin从XSD文件创建Java类。

When compiling my module with Maven no errors are displayed. 使用Maven编译模块时,不会显示任何错误。 Even when using the command make or compile in IntelliJ no errors are displayed in the status popup. 即使在IntelliJ中使用命令makecompile ,状态弹出窗口中也不会显示错误。

But in the files itself and in the project browser compile errors are constantly displayed. 但是在文件本身和项目浏览器中,编译错误会不断显示。 It seems like IntelliJ doesn't recognize the import statements of my classes in the target folder. 似乎IntelliJ无法识别目标文件夹中我的类的import语句。

The error statements look like this (bold means coloured in red): 错误语句如下所示(粗体表示为红色):

com.my.package. com.my.package。 generated .MyClass 生成的 .MyClass

The generated package seems to be invisible for the IDE. generated包对于IDE似乎是不可见的。 How can I fix this? 我怎样才能解决这个问题?

After using this workaround and recreating my project it worked again. 使用此替代方法并重新创建我的项目后,它再次工作。

Quote: 引用:

If you use maven-jaxb2-plugin with multiple schema for example 例如,如果您将maven-jaxb2-plugin与多个架构一起使用

  <configuration> <bindingDirectory>src/main/xjb/</bindingDirectory> <schemaDirectory>src/main/resources/</schemaDirectory> </configuration> 

with multiple xsd/xjb in it. 其中有多个xsd / xjb。 One with: 与之一:

  <jaxb:schemaBindings> <jaxb:package name="com.test.a"/> </jaxb:schemaBindings> 

Another with: 另一个具有:

  <jaxb:schemaBindings> <jaxb:package name="com.test.b"/> </jaxb:schemaBindings> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM