What is the proper pom configuration to use jaxb2:xjc

I am attempting to use jaxb2:xjc to generate domain java files form multiple .xsd files. The following is the build portion of my pom.xml file:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>xjc-atom-schema</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                        <configuration>
                            <clearOutputDir>true</clearOutputDir>
                            <outputDirectory>${project.basedir}/src/main/java/org.greenbuttonalliance.gba_sandbox/common/model/atom</outputDirectory>
                            <packageName>org.greenbuttonalliance.gba_sandbox.common.model.atom</packageName>
                            <sources>
                                <source>${project.basedir}/src/main/resources/atom.xsd</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>xjc-energy-schema</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                        <configuration>
                            <clearOutputDir>true</clearOutputDir>
                            <outputDirectory>${project.basedir}/src/main/java/org.greenbuttonalliance.gba_sandbox/common/model/energy</outputDirectory>
                            <sources>
                                <source>${project.basedir}/src/main/resources/usage.xsd</source>
                            </sources>
                            <packageName>org.greenbuttonalliance.gba_sandbox.common.model.energy</packageName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>xjc-retailcustomer-schema</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                        <configuration>
                            <clearOutputDir>true</clearOutputDir>
                            <outputDirectory>${project.basedir}/src/main/java/org.greenbuttonalliance.gba_sandbox/common/model/retailcustomer</outputDirectory>
                            <sources>
                                <source>${project.basedir}/src/main/resources/retailcustomer.xsd</source>
                            </sources>
                            <packageName>org.greenbuttonalliance.gba_sandbox.common.model.retailcustomer</packageName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

I am able to successfully execute mvn clean install but when I attempt to perform mvn jaxb2:xjc I receive the following error message:

Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:3.2.0:xjc (default-cli) on project common: : MojoExecutionException: NoSchemasException 

The pom build portion above is in the common sub-directory and is intended to be used as a library jar for the other sub-directories shown in my project directory structure:

The mvn jaxb:xjc command is being executed in the common sub-directory.

Any assistance would be greatly appreciated.

I have tried several project organizations and was able to finally get the mvn install to work by moving the .xsd files to the common sub-directory’s resource folder rather than having them in a schema folder within the resource directory.

I’ve executed the mvn jaxb2:xjc command with the -X diagnostic option. According to the output, Jaxb2 is using the default output directory although the outputDirectory is overridden by the org.codehaus.mojo plugin configuration contents. Does this mean the real issue is that the xjc is not properly processing the pom.xml file in the common sub-directory and is really looking at another pom.xml file?

The short goal jaxb2:xjc can only be user with single configuration since it is executed with default-cli id (see mvn output and plugin execution when run with normal clean install and with only jaxb2:xjc)

See related issue on another similar plugin : https://github.com/highsource/jaxb-tools/issues/520#issuecomment-1987970784

Another tip out of initial question : you should generate sources outside the src/main/java directory but more in something like target/generate-sources/xjc-XXX with XXX being different for each different execution.

2

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