2
我想让我的pom.xml生成hashCode()和等于我的JAXB对象上的方法()。JAXB等于和哈希代码:给出错误
<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
我GOOGLE了一下,我发现一个有关添加后..
<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>
但这没有帮助。
任何人都可以帮助我!
的JAXB2-基本运行时的团队确实很大通过介绍版本0.5.2和0.5.3之间API不兼容的变化,如[此处]所述(http://confluence.highsource.org/display/J2B/JAXB2+Ba SICS +运行系统)。这会导致问题。 – FrVaBe
如果你是因为Intuit Quickbooks SDK的构建错误而来到这里,像我这样做:你只需要添加依赖关系。 Intuit已经为你运行了插件。 –