How to use master pom file to checkout all modules of a web application and build all modules

会有一股神秘感。 提交于 2019-11-30 22:18:11

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>

I faced to same situation and I found a solution -using your code :D- that works on my computer:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>de.xxx.internet</groupId>
    <artifactId>my-app</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Maven Quick Start Archetype</name>
    <url>http://www.mySite.de</url>
    <scm>
        <connection>scm:svn:http://svn-repo-adress:8080/repo/myDirectory</connection>
        <developerConnection>http://svn-repo-adress:8080/repo/myDirectory</developerConnection>
        <tag>HEAD</tag>
        <url>http://svn-repo-adress:8080/repo/myDirectory</url>
    </scm>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-scm-plugin</artifactId>
               <version>1.6</version>
               <configuration>
                 <goals>checkout</goals>
                 <checkoutDirectory>target/checkout</checkoutDirectory>
                 <username>username</username>
                 <password>userpassword</password>
               </configuration>
              <executions>
                <execution>
                    <id>check-out-project1</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>checkout</goal>
                    </goals>
                </execution>
            </executions>   
            </plugin>
        </plugins>
     </build>
</project>

After I executed "mvn scm:checkout" on the cmd console it did work.

I think the important point was to add the scm tag first, before I had executed the build tag.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!