maven-jaxb2-plugin 不生成任何输出
我是 Maven 新手,正在尝试使用它从我的 XSD 生成 Java 类。
我的 xsd 文件位于 src/main/resources/xsd
在依赖项中我有这个,但我认为我不需要它,因为我使用的是 Java 1.6
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
</dependency>
在构建部分我有
<build>
<pluginManagement>
..
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
..
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<includeSchemas>
<includeSchema>**/test.xsd</includeSchema>
</includeSchemas>
<generatePackage>com.myproject.adapter.generated</generatePackage>
<bindingDirectory>src/main/binding</bindingDirectory>
<removeOldOutput>true</removeOldOutput>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
但是,当我运行它时,我什么也得不到。 我已经运行 mvncompile 和generate-sources,并使用 -e 和 -X 标志来查看输出,但目标似乎没有被调用。 有什么想法吗?
I'm new to Maven, and am trying to use it to generate the Java classes from my XSD.
My xsd file is in src/main/resources/xsd
In dependencies I have this, but I don't think I need it as I'm using Java 1.6
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
</dependency>
In the build section I have
<build>
<pluginManagement>
..
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
..
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<includeSchemas>
<includeSchema>**/test.xsd</includeSchema>
</includeSchemas>
<generatePackage>com.myproject.adapter.generated</generatePackage>
<bindingDirectory>src/main/binding</bindingDirectory>
<removeOldOutput>true</removeOldOutput>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
But, when I run it, I get nothing.
I've run mvn compile and generate-sources, with the -e and -X flags to have a look at the output, but it seems the target isn't getting invoked.
Any ideas ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您应该始终指定您正在使用的依赖项或插件的版本
,然后您必须在执行中提供以下条目
这是一个完整的定义,我已经包含了 jaxb2-basics 插件,因为您几乎总是想要它的功能。
first off you should always specify which version of a dependency or plugin you are using
then you have to supply the following entries inside an execution
Here is a complete definition, I have included the jaxb2-basics plugin as you almost always want what it does.