IntelliJ IDEA generated classes not seeing their own dependency

I have a maven project that auto generates some classes using the JAXB plugin in the POM. Everything in the project works fine, the project builds correctly, and runs without any issues, however IntelliJ is not seeing that one of the generated classes relies on another, so is constantly telling me that there are issues in the project.

I can resolve these alleged issues by importing one of the generated classes into the other, however that defeats the point of an auto generated class!

The JAXB plugin in the POM is configured as follows:

        <plugin>
            <groupId>org.jvnet.jaxb</groupId>
            <artifactId>jaxb-maven-plugin</artifactId>
            <version>4.0.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>src/main/resources/XSD</schemaDirectory>
                <schemaIncludes>
                    <include>*.xsd</include>
                </schemaIncludes>
            </configuration>
        </plugin>

The XSD being called upon looks as follows:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <!-- Definition of the root element -->
    <xs:element name="Person">
        <xs:complexType>
            <xs:sequence>
                <!-- First Name field -->
<!--                <xs:element name="FirstName" type="xs:string" />-->
                <xs:element name="FirstName" type="NameType" />
                <!-- Middle Name field -->
                <xs:element name="MiddleName" type="xs:string" />
<!--                <xs:element name="MiddleName" type="NameType" />-->

                <!-- Surname field -->
<!--                <xs:element name="Surname" type="xs:string" />-->
                <xs:element name="Surname" type="NameType" />

                <!-- Postcode field -->
<!--                <xs:element name="Postcode" type="xs:string" />-->
                <xs:element name="Postcode" type="NameType" />

                <!-- Date of Birth field -->
                <xs:element name="DateOfBirth" type="DateType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <!-- Custom complex type for Name with value attribute -->
    <xs:complexType name="NameType">
        <xs:attribute name="value" type="xs:string" use="required" />
    </xs:complexType>

    <!-- Custom simple type for Date of Birth with format validation -->
    <xs:simpleType name="DateType">
        <xs:restriction base="xs:string">
            <xs:pattern value="d{4}d{2}d{2}" /> <!-- Pattern for 'yyyyMMdd' -->
        </xs:restriction>
    </xs:simpleType>

</xs:schema>

JAXB created three auto generated classes from this: NameType, Person, and ObjectFactory. The path of all three of these is target/generated-sources/xjc/generated.

generated-sources is marked in IntelliJ as the the “Generated Sources Root”, and in the project settings I can see that target/generated-sources, target/generated-sources/annotations, and target/generated-sources/xjc/generated have all been added as source folders.

In order to stop IntelliJ thinking there are issues I must add an import generated.NameType; to the Person class, and import generated.NameType; import generated.Person; to the ObjectFactory.

Is there a setting I change in IntelliJ in order that it recognises these things by default. Again, I re-iterate, my code builds and runs absolutely fine – this issue just causes problems with things like Git from automatically pushing, as it believes there are errors, and it is generally annoying to be told there are issues when there aren’t any.

In case any of the following is relevant:

I’m using IntelliJ IDEA 2024.1.4 (Ultimate Edition) on an Intel Mac running 13.5.1, and the general POM properties are as follows:

<properties>
        <compiler-plugin.version>3.12.1</compiler-plugin.version>
        <maven.compiler.release>21</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
        <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
        <quarkus.platform.version>3.9.3</quarkus.platform.version>
        <skipITs>true</skipITs>
        <surefire-plugin.version>3.2.5</surefire-plugin.version>
    </properties>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật