将生成的源作为源文件夹添加到Eclipse [英] Add generated-sources as source folder to Eclipse
问题描述
我使用maven-jaxb-plugin来生成基于xsd文件的类文件源:
< plugin> ;
如上所述。
< groupId> com.sun.tools.xjc.maven2< / groupId>
< artifactId> maven-jaxb-plugin< / artifactId>
< version> 1.1.1< / version>
<执行>
< execution>
< id> jaxb-xsd-constants< / id>
< phase> generate-sources< / phase>
< goals>
< goal>生成< / goal>
< / goals>
< configuration>
< generatePackage> com.mypackage< / generatePackage> X-454545454545 X- 20045 X-4545 X-4545 X- 20045 X-4545 X-4545 X-4545 X-4545 X-4545 X- 20045 X-4545 X- 20045 X-
< includeSchemas>
< includeSchema> mylist.xsd< / includeSchema>
< / includeSchemas>
< strict> true< / strict>
< / configuration>
< / execution>
< / executions>
< / plugin>新评新新新新新旗新新旗新新旗新新旗旗哨位置200 200 200 200 200 200 200 200 200 200 CE 200454545 X- 20045454545 X- 200 X- 200 200 X- 200 X- 20045 X- 200 X- 200 X- 200 X- 200 X- 200 X- 200 X- 200 200 b
$ b如何使用插件或其他方法将文件夹添加为源文件夹?新新新新旗新新新200新新新旗新新旗新新旗新新旗200新新新新旗新新旗200 200 200 200新新新新旗新新旗200新新新旗新新旗200新新新旗新新旗新新旗新旗新旗新旗新旗新旗新旗新新旗新旗新旗新旗新旗新旗新新旗新新旗新旗新旗新旗新旗新旗新旗新新旗新新旗新旗新旗新旗新旗新新旗新旗新旗新旗新旗新新旗新新旗新旗新旗新旗新旗新新旗新新旗新新旗旗号旗新新旗新新旗新旗新旗新旗新新旗新旗新旗新旗新旗新新旗新新旗新新旗旗号旗新旗新新旗新旗新旗新旗新旗新旗新新旗新旗新旗新旗新旗新新旗新新旗新ul>
使用自动添加源目录的现代插件( maven-jaxb2-plugin
这样做)。
使用像buld-helper-maven -plugin to maven-jaxb2-plugin I'm using the maven-jaxb-plugin to generate class file sources based on xsd files :
<plugin> <groupId>com.sun.tools.xjc.maven2</groupId> <artifactId>maven-jaxb-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <id>jaxb-xsd-constants</id> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> <configuration> <generatePackage>com.mypackage</generatePackage> <schemaDirectory>${basedir}/src/main/resources/xsd/mylist</schemaDirectory> <includeSchemas> <includeSchema>mylist.xsd</includeSchema> </includeSchemas> <strict>true</strict> </configuration> </execution> </executions> </plugin>
But I then need to add these folders as a source folder in order for Eclipse to load compile them :
How can the folder be added as a source folder using the plugin or some other method ? Instead of having to manually add these folders.
解决方案Two options:
- use a modern plugin like which adds source dirs automatically (
maven-jaxb2-plugin
does this). - use something like a buld-helper-maven-plugin to add source folders.
Disclaimer: I am the author of the maven-jaxb2-plugin
mentioned above.
这篇关于将生成的源作为源文件夹添加到Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!