Generating hashCode() and equals() when creating Java classes using Mojo Jaxb2 maven plugin

前端 未结 7 1706
逝去的感伤
逝去的感伤 2020-12-03 15:18

The code I\'m working on is using jaxb2-maven-plugin from org.codehaus.mojo to generate Java classes from XSD schema. I\'m looking for a way to aut

相关标签:
7条回答
  • This is the easiest way to do. Please update version as per your requirements.

    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>jaxb2-maven-plugin</artifactId>
                        <version>1.5</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.jvnet.jaxb2_commons</groupId>
                                <artifactId>jaxb2-commons-lang</artifactId>
                                <version>2.3</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>JAXB generate content classes</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>xjc</goal>
                                </goals>
                                <configuration>
                                    <schemaDirectory>${project.basedir}/src/main/resources/schema</schemaDirectory>
                                    <outputDirectory>${project.build.directory}/generated-sources/jaxb</outputDirectory>
                                    <schemaFiles>**/*.xsd</schemaFiles>
                                    <packageName>com.lexus.web.content.model</packageName>
                                    <arguments>-Xcommons-lang</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
    
    0 讨论(0)
提交回复
热议问题