Search code examples
javamavencommitcvsvcs-checkout

How to checkout code from CVS using Maven


I am looking for following things.

  1. How to checkout code from CVS

  2. How to checkin and update code from CVS

My CVS server name:cecvs02dv which can be accessed using user name and password (and cannot be accessed over HTTP)

CVS folder: c:\cvs\dev

Module name: i3LOC

Connection configuration to CVS

<scm>

<connection>scm:cvs:ext:cecvs02dv:c:\cvs\dev:i3LOC</connection>

</scm>

Initial POM XML

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.td.insurance</groupId>
<artifactId>Test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Test</name>
<url>http://maven.apache.org</url>

<scm>

<connection>scm:cvs:ext:cecvs02dv:c:\cvs\dev:i3LOC</connection>

</scm>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.td.insurance</groupId>
        <artifactId>batchframework</artifactId>
        <version>1.4</version>
    </dependency>

</dependencies>

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.0-beta-9</version>
        <configuration>
           <useReleaseProfile>false</useReleaseProfile>
           <goals>deploy</goals>
           <scmCommentPrefix>[bus-core-api-release-checkin]-</scmCommentPrefix>
        </configuration>
     </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.7</version>
            <configuration>
                <providerImplementations>
                    <cvs>cvs_native</cvs>
                </providerImplementations>
            </configuration>
        </plugin>

    </plugins>
</build>

Error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.7:update (default-cli) on project Test: Cannot run update command : Ca
n't load the scm provider. The scm url is invalid. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Any hint will be very useful

Edited: After changing SCM tag in POM.xml

<scm>
<connection>scm:cvs|pserver|username|password@cecvs02dv|c:/cvs/dev|IRM</connection>
 <developerConnection>scm:cvs|pserver|username|password@cecvs02dv|c:/cvs/dev|IRM</developerConnection>
<tag>HEAD</tag>
 <scm>

when I execute command mvn scm:checkout it throws below error.

[INFO] Change the default 'cvs' provider implementation to 'cvs_native'.
[INFO] Removing D:\vinu\workspace\Maven\IRM\target\checkout
[INFO] Executing: cmd.exe /X /C "cvs -z3 -f -d     :pserver:username@cecvs02dv:c:/cvs/dev -q checkout -d checkout IRM"
[INFO] Working directory: D:\vinu\workspace\Maven\IRM\target
[ERROR] Provider message:
[ERROR] The cvs command failed.
[ERROR] Command output:
[ERROR] Empty password used - try 'cvs login' with a real password
cvs [checkout aborted]: authorization failed: server cecvs02dv rejected access to     c:/cvs/dev for user username

However when I try to checkout using below command from command prompt it works

cvs -z3 -f -d :pserver:username:passsword@cecvs02dv:2401:c:\cvs\dev -q checkout -d checkout IRM

More details can be found here:

How to checkout project from head using CVS command using windows command prompt


Solution

  • I spend quite a some time and could not find a solution using Maven SCM plugin. Also the documentation for Maven SCM plugin is not that good.

    I am able to resolve the issue using ant plugin (maven-antrun-plugin). For detail solution please refer

    CVS Checkout using MAVEN ANT plugin