使用注释@XmlJavaTypeAdapter定制生成的package-info的最佳方式是什么?我的包信息已经有了"@javax.xml.bind.annotation.XmlSchema“注释。
我使用的是Maven和Liferay 6.2。
发布于 2016-08-30 22:24:51
我对jaxb2-maven-plugin的解决方案是:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>bla</id>
<phase>generate-resources</phase>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${somevariable}/somexsd.xsd</source>
</sources>
<outputDirectory>src/main/generated-sources/jaxb/</outputDirectory>
<encoding>UTF-8</encoding>
<locale>en</locale>
<packageName>de.something.generated</packageName>
<noPackageLevelAnnotations>true</noPackageLevelAnnotations>
</configuration>
</execution>
</executions>
</plugin>使用"noPackageLevelAnnotations=true“时,您的包"de.something.generated”中将不会生成任何包-info.java。
现在,您只需在常规的src/main/java下添加相同的包"de.something.generated“,并将您自己的包-info.java放在其中
只需构建并享受;)
https://stackoverflow.com/questions/38962845
复制相似问题