我有一个Maven项目,其XJC目标是从XSD架构生成模型。我希望在生成的模式中,还会生成equals
和hashCode
方法。
我试过了:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<id>xjc_bonjour</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/resources/xsd/bonjour</source>
</sources>
<packageName>xxx.jobs.bonjour.schema</packageName>
</configuration>
</execution>
</executions>
</plugin>
和
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<extension>true</extension>
<generatePackage>xxx.jobs.bonjour.schema</generatePackage>
<args>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.4</version>
</plugin>
</plugins>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-runtime</artifactId>
<version>0.6.4</version>
</dependency>
</dependencies>
我真的不知道这里有什么问题,当我做maven生成的资源时,equals
和hashCode
方法不属于bonjour模型。