小编The*_*ury的帖子

如何使用jaxb2生成toString方法?

我想从我的 wsdl 中重载 toString 方法。

在我的 pom.xml 中

  1. 我在依赖项中添加了它:

    <dependency>
        <groupId>org.jvnet.jaxb2_commons</groupId>
        <artifactId>jaxb2-basics-runtime</artifactId>
        <version>1.11.1</version>
    </dependency>
    
    Run Code Online (Sandbox Code Playgroud)
  2. 我在 build/plugins 中添加了这个插件

块引用

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.7.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>${project.build.directory}/wsdl/META-INF/wsdl/</schemaDirectory>
                <schemaIncludes>
                    <include>FrameworkGedServiceMetier.wsdl</include>
                </schemaIncludes>
                <args>
                    <arg>-XtoString</arg>
                    <arg>-Xequals</arg>
                    <arg>-XhashCode</arg>
                    <arg>-Xcopyable</arg>
                </args>
                <plugins>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>1.11.1</version>
                    </plugin>
                </plugins>
            </configuration>
        </plugin> 
Run Code Online (Sandbox Code Playgroud)

我构建maven 成功,但我的类中没有我的方法toString。

为了激励我,我使用这个文档

java jaxb tostring pom.xml maven

6
推荐指数
1
解决办法
4341
查看次数

标签 统计

java ×1

jaxb ×1

maven ×1

pom.xml ×1

tostring ×1