Question

I need to download from 2 different svn locations to the same output directory. So i configured 2 different executions. But every time it executes a checkout deletes the output directory so it also deletes the already downloaded projects.

Here is a sample of my pom.xml:

<profile>
  <id>checkout</id>
  <activation>
    <property>
      <name>checkout</name>
      <value>true</value>
    </property>
  </activation>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.3</version>
        <configuration>
          <username>${svn.username}</username>
          <password>${svn.pass}</password>
          <checkoutDirectory>${path}</checkoutDirectory>
          <skipCheckoutIfExists/>
        </configuration>
        <executions>
          <execution>
            <id>checkout_a</id>
            <configuration>
              <connectionUrl>scm:svn:https://host_n/folder</connectionUrl>
              <checkoutDirectory>${path}</checkoutDirectory>
            </configuration>
            <phase>process-resources</phase>
            <goals>
              <goal>checkout</goal>
            </goals>
          </execution>
          <execution>
            <id>checkout_b</id>
            <configuration>
              <connectionUrl>scm:svn:https://host_l/anotherfolder</connectionUrl>
              <checkoutDirectory>${path}</checkoutDirectory>
            </configuration>
            <phase>process-resources</phase>
            <goals>
              <goal>checkout</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

Is there any way to prevent the executions to delete the folder ${path} ?


I came up with a solution but I cant get it to work:

I added to the profile a execution of maven-clean-plugin:

<profile>
  <id>checkout</id>
  ...
  <plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <executions>
      <execution>
        <id>not-clean</id>
        <configuration>
          <filesets>
            <fileset>
              <directory>${path}</directory>
              <excludes>
                <exclude>*/*</exclude>
              </excludes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
        <phase>initialize</phase>
        <goals>
          <goal>clean</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

But I cant realize how to exclude everything in folder.

Any Idea?

Was it helpful?

Solution

Yes: Put each SVN location in a Maven module (a sub-project) and then create a third project which contains the code to join the two.

Background: With Maven, you always have one project per POM.xml. If you feel that you need to join data from several places, create modules and then use a parent POM to join them into one "reactor project".

To build, invoke Maven in the parent "reactor project".

OTHER TIPS

I've modified the source of the maven-scm-plugin. Added functionality I needed.

Thanks for your time and help!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top