从 XSD 生成 Bean 时,jaxb2-maven-plugin 始终打印警告
我正在尝试使用 jaxb2-maven-plugin maven 插件从 xsd 生成 bean,但是每次生成 bean 时我都会收到以下警告。请注意,结果 bean 可以工作。 有人知道为什么会发生这种情况吗?
--snip--
[INFO] task-segment: [deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:xjc {execution: default}]
[INFO] Generating source...
[INFO] parsing a schema...
[INFO] compiling a schema...
[WARNING] null[-1,-1]
org.xml.sax.SAXParseException: generating code
at com.sun.tools.xjc.ErrorReceiver.debug(ErrorReceiver.java:113)
at com.sun.tools.xjc.Driver.run(Driver.java:315)
at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:301)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
--snip--
这是 pom.xml 中的配置
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.some.package.jaxb</packageName>
<verbose>true</verbose>
</configuration>
</plugin>
虽然我认为我在技术上使用 2.0.3 (而不是 2.0),但以下是引发此问题的代码行:
**如果我在 pom 中将 verbose 设置为 false,我不会收到警告。这只是一个草率的日志机制吗? **
谢谢
--马蒂亚斯
I'm trying to generate beans from an xsd by using the jaxb2-maven-plugin maven plugin, however each time the beans are generated i get the following warning. Note that the result beans work. Does anyone know why this happens?
--snip--
[INFO] task-segment: [deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:xjc {execution: default}]
[INFO] Generating source...
[INFO] parsing a schema...
[INFO] compiling a schema...
[WARNING] null[-1,-1]
org.xml.sax.SAXParseException: generating code
at com.sun.tools.xjc.ErrorReceiver.debug(ErrorReceiver.java:113)
at com.sun.tools.xjc.Driver.run(Driver.java:315)
at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:301)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
--snip--
This is the config in the pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.some.package.jaxb</packageName>
<verbose>true</verbose>
</configuration>
</plugin>
While i think i'm technically using 2.0.3 (not 2.0), here is the line of code that starts this issue:
http://grepcode.com/file/repo1.maven.org/maven2/com.sun.xml.bind/jaxb-xjc/2.0/com/sun/tools/xjc/Driver.java#315
**If i set verbose to false in the pom i don't get the warning. Is this just a sloppy logging mechanism? **
Thanks
--Matthias
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“问题”在于详细选项设置为 true - 如果您将其删除,警告就会消失。
The "problem" lies in verbose option set to true - it you'll take it out, the warning disappears.
@lexcore,你是对的。看来您的“事实上的”标准实际上是一个更好的选择,并且效果同样好。根据记录,这是一篇关于差异的好文章。
这是我使用的配置。我很难追踪到它所在的仓库。希望这对某人有帮助:
@lexicore, you are right. It seems like your "de-facto" standard is actually a better choice, and works just as good. For the record this is a good read about the differences.
This is the config i used. I had trouble tracking down what repo it was on. Hopefully this helps someone: