简体   繁体   English

带有xmlbeans的Eclipse Maven多模块项目

[英]Eclipse Maven multi module project with xmlbeans

I have a multi module project, in which one of the module ( say MODULE-A) generates sources and classes using xmlbeans plugin. 我有一个多模块项目,其中一个模块(比如MODULE-A)使用xmlbeans插件生成源和类。 So everytime when I do a clean install of parent project, eclipse recognizes all of the generated sources as new classes, and I don't want to commit the same files again and again when there is no schema change. 因此,每当我对父项目进行全新安装时,eclipse都会将所有生成的源识别为新类,并且我不希望在没有架构更改时一次又一次地提交相同的文件。 To overcome this problem, I wrapped xmlbeans build under a profile so that I can build it with profile whenever there is a schema change. 为了解决这个问题,我在一个配置文件下包装了xmlbeans,这样我就可以在架构发生变化时使用配置文件构建它。 But it didn't solve the problem completely. 但它并没有完全解决问题。

Whenever I try to do clean build of parent, MODULE-A is not creating 'schemaorg_apache_xmlbeans' under build directory ( which is something only generated by xmlbean plugin when I run with profile ). 每当我尝试干净构建父级时,MODULE-A都不会在构建目录下创建“schemaorg_apache_xmlbeans”(这是我在运行配置文件时仅由xmlbean插件生成的)。 I can tell maven to exclude 'schemaorg_apache_xmlbeans' from the clean task. 我可以告诉maven从clean任务中排除'schemaorg_apache_xmlbeans'。 But I want to know if this is the right way to handle. 但我想知道这是否是正确的处理方式。

Appreciate your responses. 感谢您的回复。

Thanks in advance 提前致谢

One alternative to this approach is to add this plugin: 这种方法的一种替代方法是添加此插件:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>add-source</id>
                  <phase>generate-sources</phase>
                  <goals>
                     <goal>add-source</goal>
                  </goals>
                  <configuration>
                     <sources>
                        <source>${project.build.directory}/generated-sources/</source>
                     </sources>
                  </configuration>
               </execution>
            </executions>
         </plugin>

This will allow the generated-sources to be added as a source folder so every time it generates you will have them built and available. 这将允许将生成的源添加为源文件夹,因此每次生成时您都将构建它们并可用。 You wouldn't commit these but when the actual jar gets built/released they will be in there and work all the same. 你不会提交这些,但是当实际的jar被构建/释放时,它们将在那里并且工作完全相同。 This allows you to always be using code most up to date with your schema. 这使您可以始终使用最新的代码与代码。 This may not be the best solution for you but I found it to be a good idea when I ran into a similar situation. 这对你来说可能不是最好的解决方案,但是当我遇到类似的情况时,我发现它是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM