将生成的源添加到类路径
Add generated sources to classpath
我用maven-jaxb2-plugin。它在正确的目录中生成我的 类,但是在 Eclipse Neon.2 Release (4.6.2) 上,该文件夹不会自动添加到类路径中。
这是我的插件配置:
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<addCompileSourceRoot>true</addCompileSourceRoot>
<generateDirectory>${project.build.directory}/generated-sources/jaxb</generateDirectory>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<generatePackage>foo.bar.pojo</generatePackage>
</configuration>
</plugin>
</plugins>
</build>
是否可以使用 maven-jaxb2-plugin 将生成的目录定义为源文件夹?如果是,如何?
Eclipse 在 <execution>
上的 pom.xml
中向我显示错误:
Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate: com/sun/xml/bind/api/ErrorListener
为了解决我的问题,我不得不更改插件的版本。
发件人:
<version>0.13.1</version>
收件人:
<version>0.12.1</version>
我用maven-jaxb2-plugin。它在正确的目录中生成我的 类,但是在 Eclipse Neon.2 Release (4.6.2) 上,该文件夹不会自动添加到类路径中。
这是我的插件配置:
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<addCompileSourceRoot>true</addCompileSourceRoot>
<generateDirectory>${project.build.directory}/generated-sources/jaxb</generateDirectory>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<generatePackage>foo.bar.pojo</generatePackage>
</configuration>
</plugin>
</plugins>
</build>
是否可以使用 maven-jaxb2-plugin 将生成的目录定义为源文件夹?如果是,如何?
Eclipse 在 <execution>
上的 pom.xml
中向我显示错误:
Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate: com/sun/xml/bind/api/ErrorListener
为了解决我的问题,我不得不更改插件的版本。
发件人:
<version>0.13.1</version>
收件人:
<version>0.12.1</version>