On my recent work, there's a requirement of having Maven to build an J2EE EAR file and then checkin the EAR to ClearCase. Maven SCM plugin has the ClearCase plugin, however, the scm:add command doesn't work for ClearCase. The problem got work around by executing Ant's ClearCase task in Maven.
Adding a source control to ClearCase involves three steps;
1 - Check out the containing folder of the new source file.
Acomplished by Ant task:
<cccheckout viewpath="c:/ci/view/my_view/MyFolder">
2 - Invoke the Clear Case mkelem command.
Acomplished by Ant task:
<ccmkelem viewpath="c:/ci/view/my_view/MyFolder/test4.ear" checkin="true" comment="Initial checkin">
</ccmkelem>
3 - Chech in the containing folder
Acomplished by Ant task:
<cccheckin viewpath="c:/ci/view/my_view/MyFolder" identical="true">
The complete POM:
<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>root.project</groupId>
<artifactId>MyProject</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>MyProject</name>
<scm>
<connection>scm:clearcase:config_spec.txt</connection>
<developerConnection>scm:clearcase:config_spec.txt</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>run</goal></goals>
<configuration>
<tasks>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<echo message="plugin classpath: ${plugin_classpath}"/>
<cccheckout viewpath="c:/ci/view/my_view/MyFolder"/>
<ccmkelem viewpath="c:/ci/view/my_view/MyFolder/test4.ear"
checkin="true"
comment="Initial checkin">
</ccmkelem>
<cccheckin viewpath="c:/ci/view/my_view/MyFolder"
identical="true"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment