IntelliJ 无法识别 JAXB 的导入语句 类
IntelliJ doesn't recognize import statements for JAXB classes
我正在使用 IntelliJ IDEA 14 作为 IDE 和 jaxb2-maven-plugin 从 XSD 文件创建 Java 类。
使用 Maven 编译我的模块时没有显示任何错误。即使在 IntelliJ 中使用命令 make
或 compile
,状态弹出窗口中也不会显示任何错误。
但是在文件本身和项目浏览器中不断显示编译错误。 IntelliJ 似乎无法识别目标文件夹中我的 类 的导入语句。
错误语句如下所示(粗体表示红色):
com.my.package.生成.MyClass
generated
包似乎对 IDE 不可见。我该如何解决这个问题?
使用 this workaround 并重新创建我的项目后,它再次运行。
引用:
If you use maven-jaxb2-plugin with multiple schema for example
<configuration>
<bindingDirectory>src/main/xjb/</bindingDirectory>
<schemaDirectory>src/main/resources/</schemaDirectory>
</configuration>
with multiple xsd/xjb in it. One with:
<jaxb:schemaBindings>
<jaxb:package name="com.test.a"/>
</jaxb:schemaBindings>
Another with:
<jaxb:schemaBindings>
<jaxb:package name="com.test.b"/>
</jaxb:schemaBindings>
我正在使用 IntelliJ IDEA 14 作为 IDE 和 jaxb2-maven-plugin 从 XSD 文件创建 Java 类。
使用 Maven 编译我的模块时没有显示任何错误。即使在 IntelliJ 中使用命令 make
或 compile
,状态弹出窗口中也不会显示任何错误。
但是在文件本身和项目浏览器中不断显示编译错误。 IntelliJ 似乎无法识别目标文件夹中我的 类 的导入语句。
错误语句如下所示(粗体表示红色):
com.my.package.生成.MyClass
generated
包似乎对 IDE 不可见。我该如何解决这个问题?
使用 this workaround 并重新创建我的项目后,它再次运行。
引用:
If you use maven-jaxb2-plugin with multiple schema for example
<configuration> <bindingDirectory>src/main/xjb/</bindingDirectory> <schemaDirectory>src/main/resources/</schemaDirectory> </configuration>
with multiple xsd/xjb in it. One with:
<jaxb:schemaBindings> <jaxb:package name="com.test.a"/> </jaxb:schemaBindings>
Another with:
<jaxb:schemaBindings> <jaxb:package name="com.test.b"/> </jaxb:schemaBindings>