Question

I'm using rcleartool 8.0.0.6 in windows machine. Is there any way to use rcleartool non-interactive mode?

For example, if I type: rcleartool lsview -s, the client will ask me to input Server URL, username/password in interactive mode.

Is there anyway to use rcleartool lsview -s -username [username] -pass [password] -server [server]?
I want to use that command in my java code, so non-interactive mode should be better?
Any suggestions?

Was it helpful?

Solution

ClearTeam 8.x

As mentioned in "The ClearCase 8.x remote client command-line interface (rcleartool)":

rcleartool is the command-line interface to the IBM Rational ClearCase remote client (CCRC).
This interface, first released as a separate download for compatibility with V7.1.2.x and later releases, is delivered in V8.0.0.3 with the changes that are described in this document.

rcleartool login wasn't caching credentials before (7.x).
It should cache those credential now.

The CR 3508 mentions that enhancement has been delivered June 14th 2013 the RFE (Request for Enhancement):

In CCRC CLI single-line mode, you should only specifiy your login credentials once.

Session caching for rcleartool was delivered in 8.0.0.3

That means after one rcleartool login -lname xxx -server xxx -password xxx, all other rcleartool commands shouldn't need login/password anymore.


ClearCase 7.x

You can try and follow the IBM article "How to run rcleartool without entering username, password and server URL every time"

It suggests modifying the rcleartool.bat script.

Cause

Normally when one runs rcleartool (not under rcleartool prompt), he needs to input username, password and server URL every time.

For instance:

rcleartool lsvob -username myusername -password mypassword -server  http://myserver:12080/TeamWeb/services/Team

rcleartool lsview -username myusername -password mypassword -server  http://myserver:12080/TeamWeb/services/Team

Answer

You can backup the original rcleartool.bat (rcleartool under UNIX) and then modify that file as follows:

Locate the following line in rcleartool.bat

"%_JAVACMD%" -Djava.util.logging.config.file="%CCRCCLI%/logging.properties" -cp "%CM_API_DIR%\stpwvcm.jar";"%CM_API_DIR%\stpcmmn.jar";"%CM_API_DIR%\stpcc.jar";"%CM_API_DIR%\remote_core.jar";"%CM_API_DIR%\commons-httpclient-3.0.jar";"%CM_API_DIR%\commons-codec-1.3.jar";"%CCRCCLI%\commons-cli-1.1.jar";"%CM_API_DIR%\icu4j-3_8.jar";"%CM_API_DIR%\commons-logging-1.0.4.jar";"%CCRCCLI%\rcleartool.jar" com.ibm.rational.ccrc.cli.command.ClearWan %*
Add the username, password and server URL at the end

"%_JAVACMD%" -Djava.util.logging.config.file="%CCRCCLI%/logging.properties" -cp "%CM_API_DIR%\stpwvcm.jar";"%CM_API_DIR%\stpcmmn.jar";"%CM_API_DIR%\stpcc.jar";"%CM_API_DIR%\remote_core.jar";"%CM_API_DIR%\commons-httpclient-3.0.jar";"%CM_API_DIR%\commons-codec-1.3.jar";"%CCRCCLI%\commons-cli-1.1.jar";"%CM_API_DIR%\icu4j-3_8.jar";"%CM_API_DIR%\commons-logging-1.0.4.jar";"%CCRCCLI%\rcleartool.jar" com.ibm.rational.ccrc.cli.command.ClearWan %* -username myusername -password mypassword -server  http://myserver:12080/TeamWeb/services/Team

After making the above change, rcleartool can be used without entering a username, password and server URL every time.

For instance,

rcleartool lsvob
rcleartool lsview

Note that there is still a need for running rcleartool directly (not in rcleartool prompt) such as:

  • Being able to capture the result with > operator.
  • Being able to run in a batch file.

OTHER TIPS

The approach for Clear Case 7.1.X doesn't work for many cases, for instance on a simple CHECKOUT operation or just launch the rcleartool CLI.

That's because the server/login options should come before the others parameters. For instance: rcleartool co -server XXX -login me -password 1234 fileToCheckOut.txt

So what I suggest is to improve a bit the correction mentioned above to separate the first input parameter given to the batch, representing the Clear Case command, from the rest, the parameters for the given command.

So it looks more or less like this in batch :

set LOGIN=-server XXX -login me -password 1234
set CMD=%1
set PARAMS=

shift
:loop1
if [%1]==[] goto after_loop
set PARAMS=%PARAMS% %1
shift
goto loop1

:after_loop

"%_JAVACMD%" -Djava.util.logging.config.file="%CCRCCLI%/logging.properties" -cp "%CM_API_DIR%\stpwvcm.jar";"%CM_API_DIR%\stpcmmn.jar";"%CM_API_DIR%\stpcc.jar";"%CM_API_DIR%\remote_core.jar";"%CM_API_DIR%\commons-httpclient-3.0.jar";"%CM_API_DIR%\commons-codec-1.3.jar";"%CCRCCLI%\commons-cli-1.1.jar";"%CM_API_DIR%\icu4j-3_8.jar";"%CM_API_DIR%\commons-logging-1.0.4.jar";"%CCRCCLI%\rcleartool.jar" com.ibm.rational.ccrc.cli.command.ClearWan %CMD% %LOGIN% %PARAMS%

Ugly as the devil himself, but it works for most cases. You can perform simple tasks like you could before, plus Check-outs/ins and similiar.

What you CAN'T do still is to launch the rcleartool CLI and use the help command. It requests me a password, and even if I enter, it fails.

edit: comparison on shift snipet was failing when receiving parameters with quotes and spaces in it.

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