IntelliJ doesn't recognize import statements for JAXB classes

北慕城南 提交于 2019-12-24 14:06:22

问题


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

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.

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.generated.MyClass

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


回答1:


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

Quote:

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>


来源:https://stackoverflow.com/questions/28720290/intellij-doesnt-recognize-import-statements-for-jaxb-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!