我试图让我的 pom.xml 在我的 JAXB 对象上生成 hashCode() 和 equals methods()。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-commons-lang</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
<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>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.2</version>
</plugin>
</plugins>
</configuration>
</plugin>
</plugins>
</build>
虽然这会产生以下错误......
package org.jvnet.jaxb2_commons.lang does not exist
package org.jvnet.jaxb2_commons.locator does not exist
package org.jvnet.jaxb2_commons.locator.util does not exist
cannot find symbol symbol: class Equals
cannot find symbol symbol: class HashCode
cannot find symbol symbol: class ToString
cannot find symbol symbol : class ObjectLocator
cannot find symbol symbol : class ToStringStrategy
cannot find symbol symbol : class HashCodeStrategy
我用谷歌搜索过,我发现了一篇关于添加的帖子。
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>runtime</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>testing</artifactId>
<version>0.4.1</version>
<scope>test</scope>
</dependency>
但这无济于事。
谁能帮帮我!