IntelliJ无法识别JAXB类的import语句 [英] IntelliJ doesn't recognize import statements for JAXB classes

查看:481
本文介绍了IntelliJ无法识别JAXB类的import语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用IntelliJ IDEA 14作为IDE并 jaxb2-maven-plugin 用于从XSD文件创建Java类。

I'm using IntelliJ IDEA 14 as IDE and jaxb2-maven-plugin for creating Java classes from XSD files.

使用Maven编译模块时,不会显示任何错误。即使在IntelliJ中使用命令 make 编译,状态弹出窗口中也不会显示错误。

When compiling my module with Maven no errors are displayed. Even when using the command make or compile in IntelliJ no errors are displayed in the status popup.

但是在文件本身和项目浏览器中,编译错误会不断显示。似乎IntelliJ无法识别目标文件夹中我的类的import语句。

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.

错误语句如下所示(粗体表示红色):

The error statements look like this (bold means coloured in red):

com.my.package。生成 .MyClass

com.my.package.generated.MyClass

生成的包似乎对IDE不可见。我该如何解决这个问题?

The generated package seems to be invisible for the IDE. How can I fix this?

推荐答案

使用此解决方法并重新创建我再次使用的项目。

After using this workaround and recreating my project it worked again.

引用:


如果你使用带有多个模式的maven-jaxb2-plugin例如

If you use maven-jaxb2-plugin with multiple schema for example

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

其中包含多个xsd / xjb。一个用于:

with multiple xsd/xjb in it. One with:

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

另一个:

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


这篇关于IntelliJ无法识别JAXB类的import语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆