how to checkout source from cvs using ant?

how to checkout source from cvs using ant?how to give pass login and pass in build script.
LVL 20
chaitu chaituAsked:
Who is Participating?
 
Nguyen Huu PhuocSenior ManagerCommented:
Did you install cvs client in your PC?
If done, you just try to set PATH environment variable to folder containing cvs.exe.
I suppose thet you know how to set an environment variable.
Change directory to the target directory and try command:
cvs -d:pserver:username@<hostaddress>:<path> login
cvs -d:pserver:username@<hostaddress>:<path> co modulename
cvs -d:pserver:username@<hostaddress>:<path> logout
Phuoc H. Nguyen

0
 
CEHJCommented:
Make a file called .cvspass in your home directory. You can then ignore the Ant build file in this respect
0
 
chaitu chaituAuthor Commented:
how to create  .cvspass in the home directory?

"You can then ignore the Ant build file in this respect"

u mean no need to connect to cvs in ant.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
CEHJCommented:
>>how to create  .cvspass in the home directory?

What OS?

>>u mean no need to connect to cvs in ant.

No, i mean no need to worry about password
0
 
chaitu chaituAuthor Commented:
XP.
0
 
CEHJCommented:
Try creating a text file with just the username in it:

notepad "%USERPROFILE%\.cvspass"
0
 
chaitu chaituAuthor Commented:
"%USERPROFILE%"

what is the meaning of this;

where to put this .cvspass file?
0
 
chaitu chaituAuthor Commented:
now .cvspass files in my userprofile directory;

how  build.xml will take this .cvspass file;
?

then how to checkout particular source from cvs
0
 
CEHJCommented:
>>how  build.xml will take this .cvspass file;

It's actually nothing to do with Ant in a way - it's what cvs itself expects
0
 
chaitu chaituAuthor Commented:
U didnt understand my problem;my question is i will not go cvs and check particular Release.

i will mention particular Release name in build.xml that should be checked out .
0
 
CEHJCommented:
There are examples in the Ant docs:

http://ant.apache.org/manual/CoreTasks/cvs.html
0
 
chaitu chaituAuthor Commented:
     <property name="cvs.root" value=":pserver:username@xxxx:/xxxx" />
      <property name="cvs.project.name" value="SourceCode/xxx/Release2" />


<cvs cvsRoot="${cvs.root}"
           package="${cvs.project.name}/src"
         
      />

     
     [cvs] Using cvs passfile: C:\Documents and Settings\username\.cvspass

     [cvs] Caught exception: CreateProcess: cvs -d:pserver:username@xxxx:/xxxx checkout "SourceCode/xxx/Release2/src" error=2
0
 
Giant2Commented:
try:
<property name="cvs.root" value=":pserver:ant:username@xxxx:/xxxx" />

<cvs cvsroot="${cvs.root}" package="${cvs.project.name}/src" passfile=".cvspass" dest="\whereToPutFiles\" />

Hope this could help you.
Bye, Giant.
0
 
chaitu chaituAuthor Commented:
in the cvspass file;do i put password in cvspass file

:pserver:xxx@xxxo:/xxxx A\*6g4Kw1V



0
 
CEHJCommented:
Make sure that package really exists
0
 
chaitu chaituAuthor Commented:
problem is with password not getting to checkout from cvs;how to set password in cvspass file
0
 
chaitu chaituAuthor Commented:
i have seen those 2 links before u posted
0
 
chaitu chaituAuthor Commented:
say if i not login to cvs without giving password;i think we are not gving password in cvspass file;are we?
0
 
CEHJCommented:
Those tell you what you need to know. If you do all three methods of setting the password, at least one of them should work ;-)
0
 
chaitu chaituAuthor Commented:
"If you do all three methods of setting the password, at least one of them should work "
0
 
CEHJCommented:
Actually i think you should ignore the .cvspass file approach. It is in a special format. Try the other two
0
 
Giant2Commented:
If you use the .cvspass file approach the file must be like following:

:pserver:THEuserNAME:THEpassWORD@THEhosNAME:/THErootONhost

Bye, Giant.
0
 
CEHJCommented:
As the link i posted suggests, though, Windows could ignore the .cvspass file. If you want to try that approach anyway, you could maybe check the last access time to see if it's being read
0
 
Nguyen Huu PhuocSenior ManagerCommented:

   >  [cvs] Using cvs passfile: C:\Documents and Settings\username\.cvspass

     >[cvs] Caught exception: CreateProcess: cvs -d:pserver:username@xxxx:/xxxx checkout SourceCode/xxx/Release2/src" error=2
Error=2 on WIndows means that you donot have cvs on your path.
Read more
http://ant.apache.org/manual/CoreTasks/cvs.html
and note that
>Important: This task needs "cvs" on the path. If it isn't, you will get an error (such as error 2 on >windows). If <cvs> doesn't work, try to execute cvs.exe from the command line in the target directory >in which you are working.
0
 
chaitu chaituAuthor Commented:
HOW TO execute cvs.exe from the command line in the target directory in which i am  working?
0
 
Giant2Commented:
Using Runtime. See here:
http://javaalmanac.com/egs/java.lang/Exec.html?l=rel

Bye, Giant.
0
 
Nguyen Huu PhuocSenior ManagerCommented:
If you execute cvs.exe from the command line in the target directory successfully, try to use ant again.
Note PATH environment variable should set by "System properties" dialog. If you just use "SET" command, ant can be not see it.
Phuoc H. Nguyen
0
 
chaitu chaituAuthor Commented:
i went into folder containing cvs.exe;

enter this

cvs -d:pserver:username@<hostaddress>:<path> login

it asked password i entered then i came back to target directory my ant is running and when i type ant still that exception is coming
0
 
CEHJCommented:
>>i went into folder containing cvs.exe;

You need to add the bin directory to your path. Simply going into that directory won't help you with Ant
0
 
Giant2Commented:
>Error=2 on WIndows means that you donot have cvs on your path.

>(CEHJ) insert the bin directory of ant in the Path

set path=%PATH%;yourabsolutedirwhereiscvs/bin

or

set the path in the environment variable.

Bye, Giant.
0
 
Nguyen Huu PhuocSenior ManagerCommented:
You have set your PATH environment variable?
0
 
CEHJCommented:
>>set path=%PATH%;yourabsolutedirwhereiscvs/bin

That will only work for that console session
0
 
chaitu chaituAuthor Commented:
i created one batch file;
set path=c:\ant\bin;
set path=c:\j2sdk1.4.2_06\bin;%path%
set path=C:\Program Files\CVSNT;%path%

in my cvs client there is no bin directory;cvspass file will ignore in windows system;
0
 
Nguyen Huu PhuocSenior ManagerCommented:
Yeah, a creative solution.
You are great!
0
 
CEHJCommented:
:-)

>>set path=C:\Program Files\CVSNT;%path%

should be

set path="C:\Program Files\CVSNT";%path%
0
 
chaitu chaituAuthor Commented:
No need to put quotes
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.