aspose file tools*
The moose likes Java in General and the fly likes Ant CVS checkout  task error=2 - and my PATH is set!? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Ant CVS checkout  task error=2 - and my PATH is set!? " Watch "Ant CVS checkout  task error=2 - and my PATH is set!? " New topic
Author

Ant CVS checkout task error=2 - and my PATH is set!?

Trupti Mnaik
Greenhorn

Joined: Apr 01, 2011
Posts: 2
Hi All,

While doing CVS checkout through Ant script i m getting following error:


D:\fol1\apache-ant-1.8.2\bin>ant
Buildfile: D:\fol1\apache-ant-1.8.2\bin\build.xml
[echo] Connecting to CVS
[echo] CVS Connected
[echo] Import completed from CVS

checkout-prj1:
[echo] Checking out the required prj1 sources from CVS

BUILD FAILED
D:\fol1\apache-ant-1.8.2\bin\build.xml:35: java.io.IOException: CreateProcess:
cvs -d${cvsRoot} -z3 checkout -P prj1 error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.AbstractCvsTask.runCommand(AbstractCvsT
ask.java:351)
at org.apache.tools.ant.taskdefs.AbstractCvsTask.execute(AbstractCvsTask
.java:408)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds

My path variable is set to cvs.exe

Following is my code fragment:


<project name="prj1" basedir="." default="checkout-prj1">


<property name="build-dir" value="build"/>
<property name="apac.pass" value="password"/>
<property name="prjpath" value="prj1"/>

<echo message="Connecting to CVS"/>

<property name="cvsroot" value=":pserver:username@cvs1.wuintranet.net:2401/home/cvsroot" />
<target name="login"
description="Update or check out required sources
from CVS for the prj1">

<echo message="CVS Login"/>
<cvspass cvsRoot="${cvsroot}" password="${apac.pass}"/>

<cvs cvsRoot="${cvsroot}" command="login"/>

</target>
<echo message="CVS Connected"/>
<target name="clean">
<delete dir="${build.dir}"/>

</target>

<target name="checkout-prj1"
description="Update or check out required sources
from CVS for the prj1">

<echo message="Checking out the required prj1 sources from CVS"/>
<cvspass cvsRoot="${cvsroot}" password="${apac.pass}"/>


<cvs cvsRoot="${cvsRoot}" command="checkout -P ${prjpath}" dest="${build-dir}" compression="true" output="patch.txt" failonerror="true" />

</target>
<echo message="Import completed from CVS"/>
</project>


Can somebody help me to solve this error???


Thanks,
Trupti.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

From the Ant documentation:
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.

This would have been my first guess even before reading this, because error 2 usually means "command not found".

And welcome to the Ranch!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Trupti Mnaik wrote:My path variable is set to cvs.exe

The PATH variable shouldn't be set to cvs.exe but to the folder containing cvs.exe. The variable isn't called PATH for nothing - it holds paths that will be searched for executables.
Trupti Mnaik
Greenhorn

Joined: Apr 01, 2011
Posts: 2
Hi Rob,

Thanks for reply. I did suggested corrections.Now I m getting another error as follows :


Buildfile: D:\Prj1\apache-ant-1.8.2\bin\build.xml
[echo] Connecting to CVS
[echo] CVS Connected
[echo] Import completed from CVS

checkout-prj1:
[echo] Checking out the required prj1 sources from CVS
[cvs] cvs checkout: CVSROOT "${cvsRoot}" must be an absolute pathname
[cvs] cvs [checkout aborted]: Bad CVSROOT.

BUILD FAILED
D:\fol1\apache-ant-1.8.2\bin\build.xml:35: cvs exited with error code 1
Command line was [Executing 'cvs' with arguments:
'-d${cvsRoot}'
'-z3'
'checkout'
'-P'
'${:pserver:username@cvs1.wuintranet.net:2401/home/cvsroot/wu/intrane
t/prj1}'

The ' characters around the executable and arguments are
not part of the command.



Please help me.

Thanks,
Trupti.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

First of all, the property is called "csvroot", not "csvRoot". Apparently Ant doesn't like the difference.

But why don't you use the "package" attribute?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Ant CVS checkout task error=2 - and my PATH is set!?
 
Similar Threads
Path setting problem in java task
unable to checkout using CVS
java.lang.VerifyError:
java.lang.VerifyError
Ant Checkout issue