如何使用主pom文件检出Web应用程序的所有模块并构建所有模块 [英] How to use master pom file to checkout all modules of a web application and build all modules

查看:82
本文介绍了如何使用主pom文件检出Web应用程序的所有模块并构建所有模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个依赖于几个模块的Web应用程序.因此要构建它,我有一个主pom.xml文件.我想要这个pom文件执行的操作是检出所有模块. 下面是我的pom文件.

I have a web application that relies on several modules. So to build it, I have a master pom.xml file. What I want this pom file to do is to checkout out all the modules. below is my pom file.

        <executions>
        <execution>
                    <id>check-out-project1</id>
                    <phase>generate-sources</phase>
                    <goals>
                    <goal>checkout</goal>
                    </goals>
                    <configuration>    
                    <checkoutDirectory>${project.build.directory}/module1</checkoutDirectory>
                    <connectionUrl>scm:svn:svn://svnserver/svn/module1/trunk</connectionUrl>
                    <!--<developerConnection>scm:svn:svn://svnserver/svn/module1/trunk</developerConnection>!-->
                    <username>username</username>                             
                    <password>password</password>             
                    </configuration>
         </execution>

          <execution>
                    <id>check-out-project2</id>
                    <phase>generate-sources</phase>
                    <goals>
                    <goal>checkout</goal>
                    </goals>
                    <configuration>    
                    <checkoutDirectory>${project.build.directory}/module1</checkoutDirectory>
                    <connectionUrl>scm:svn:svn://svnserver/svn/module1/trunk</connectionUrl>
                          <username>username</username>                             
                          <password>password</password>             
                    </configuration>
            </execution>
        </executions>

我尝试了 mvn scm:checkout mvn scm:checkout -check-out-project1 ,但它给了我错误: 无法运行checkout命令:无法加载scm提供程序.您需要定义一个connectionUrl参数.

I have tried mvn scm:checkout and mvn scm:checkout -check-out-project1 but it give me the error: Cannot run checkout command : Can't load the scm provider. You need to define a connectionUrl parameter.

我不明白为什么会这样,因为我已经在pom文件中定义了connectionUrl参数,我想要了解的想法是将pom文件配置为能够在同一时间签出多个项目时间.在此先感谢您,让我知道我在做什么错.

I don't understand why this is happening since I have the connectionUrl parameters defined inside the pom file already,the ideas point that I want to get to is having the pom file configured to be able to checkout multiple projects at the same time. Please let me know what I am doing wrong here, Thanks in Advance.

推荐答案

我发现,如果将每个结帐放入其自己的<execution> ... </execution>中并放置在适当的位置,则单个<configuration> ... </configuration>会起作用.例如:

I found that if placing each of the checkouts into its own <execution> ... </execution> and within place the individual <configuration> ... </configuration> for them works. For example:

 <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.9.4</version>
            <executions>
                <execution>
                    <id>repo1-dependency</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <connectionUrl>${my.repo1.url}</connectionUrl>
                        <scmVersion>${my.repo1.branch}</scmVersion>
                        <scmVersionType>branch</scmVersionType>
                        <checkoutDirectory>${project.build.directory}/${my.repo1}-${my.repo1.branch}</checkoutDirectory>
                    </configuration>
                    <goals>
                        <goal>checkout</goal>
                    </goals>
                </execution>
                <execution>
                    <id>repo2-dependency</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <connectionUrl>${my.repo2.url}</connectionUrl>
                        <scmVersion>${my.repo2.branch}</scmVersion>
                        <scmVersionType>branch</scmVersionType>
                        <checkoutDirectory>${project.build.directory}/${my.repo2}-${my.repo2.branch}</checkoutDirectory>
                    </configuration>
                    <goals>
                        <goal>checkout</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

这篇关于如何使用主pom文件检出Web应用程序的所有模块并构建所有模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆