简体   繁体   English

jaxb2-maven-plugin在控制台上报告问题

[英]jaxb2-maven-plugin to report problems on Console

I have a maven-based build script that runs jaxb2-maven-plugin (schemagen) to generate XSD from Java classes. 我有一个基于Maven的构建脚本,该脚本运行jaxb2-maven-plugin(schemagen)从Java类生成XSD。 I have done something wrong and it won't generate it. 我做错了什么,它不会生成它。

The project is very complex and it is difficult to re-create in console the exact command line. 该项目非常复杂,很难在控制台中重新创建确切的命令行。

In my .pom file I just have 在我的.pom文件中

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>schemagen</id>
                    <goals>
                        <goal>schemagen</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includes>
                    <include>**/*.java</include>
                </includes>
            </configuration>
        </plugin>

What options I may use to command schemagen / plugin to show what was the cause of error on console? 我可以使用哪些选项来命令schemagen / plugin以显示控制台错误的原因?

Answer to your question 回答你的问题

  1. I didn't find anything wrong in your POM.xml file, as I used the same POM file and it is generating the required schema at my target directory. 在您的POM.xml文件中没有发现任何错误,因为我使用了相同的POM文件,并且该文件正在目标目录中生成所需的架构。
  2. Please find the Domain Object user and I have generated XSD schema. 请找到域对象用户,并且我已经生成了XSD架构。

      /** * */ package com.example; /** * @author Praveen * */ public class User { private String ename; private String designation; public String getEname() { return ename; } public void setEname(String ename) { this.ename = ename; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } } 
  3. POM file POM文件

      <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> <groupId>org.app</groupId> <artifactId>sample</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.6</version> <executions> <execution> <id>schemagen</id> <goals> <goal>schemagen</goal> </goals> </execution> </executions> <configuration> <includes> <include>**/*.java</include> </includes> </configuration> </plugin> </plugins> </build> </project> 
  4. Maven Goals as Maven目标为

    clean install -e 全新安装-e

  5. Output on my IDE, please refer below figure. 我的IDE上的输出,请参考下图。

模式生成

方案

  1. Please refer these example from this link 请从此链接参考这些示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM