Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven SVN checkout

Tags:

svn

maven

Can anybody tell me how to make checkout and further updates from SVN with Maven? I read the documentation on maven.apache.org but it seems that i'm too dumb for this because i can't understand how to use scm:checkout and scm:update without passing them parameters in command line. I mean when i run just:

mvn scm:checkout (or scm:update) clean install 

maven checks out sources to /target/checkout, then it deletes it and of course it has nothing to compile so it makes empty jar. So i have to write something like this:

mvn scm:checkout -DconnectionUrl=scm:svn:http://svn.my.dev/scm/repo/trunk/myProject -DcheckoutDirectory=src clean install

But i don't want to! How can i set these parameters inside pom.xml? And how can i set current directory as checkoutDirectory? (probably it should not be a problem if set it in pom.xml because i can set it as ${project.basedir}, but who knows) My pom.xml includes these lines:

...
  <scm>
    <connection>scm:svn:http://svn.my.dev/scm/repo/trunk/myProject</connection>
    <developerConnection>scm:svn:http://svn.my.dev/scm/repo/trunk/myProject</developerConnection>
  </scm>
...
  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.7</version>
        <configuration>
      <username>username</username>
          <password>password</password>
        </configuration>
      </plugin>
...

Btw, what is the difference between connection and developerConnection. Maven documentation says only that developerConnection is... "The SCM connection URL for developers". Which is very surprising for me 'cause i thought that this is some connection for squirrels or may be bunnies.

like image 246
mykola Avatar asked Oct 08 '22 08:10

mykola


1 Answers

You can add the checkoutDirectory option directly to the configuration of the maven-scm-plugin. Once the files are checked out, you can use scm:update with the workingDirectory option (can be configured in the plugin configuration as well)

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-scm-plugin</artifactId>
  <version>1.7</version>
  <configuration>
    <username>username</username>
    <password>password</password>
    <checkoutDirectory>${project.basedir}/src</checkoutDirectory>
    <workingDirectory>${project.basedir}/src</workingDirectory>
  </configuration>
</plugin>
like image 161
Stefan Ferstl Avatar answered Oct 18 '22 12:10

Stefan Ferstl