How do I add a new directory into my CVS repository using Ant? From all that I've read, it appears that I have to cd to the parent directory and call the cvs command. How do I do that in Ant? I've seen approaches where an to cd is called in Ant; is that the best approach?
Eg of what I am trying to do:
Let's say I have a module Test_Module with directories "A", "B" and "C". Under each of these directories, there are directories for "Jan", "June", "Sept" and I want to create a "Alpha" directory under Test_Module-> C -> Sept.
So, I create a "Alpha" directory on my local system and run the cvs add command from Root and I get the following errror:
cvs add: in directory .:
cvs [add aborted]: there is no version here; do 'cvs checkout' first
I get the same error when I run this using Ant or from command line.
Now, if I cd to the Test_Module/C/Sept directory and run "cvs add Alpha" it creates the directory and everything is fine. So, how do I do the same in Ant? Are there any ant-contrib tasks that are out there that I could possibly use or even a built-in ant task that I am missing?
Thanks in Advance!!
did you look at the Ant CVS task?
I haven't used CVS for a while but since it's possible to manage a Subversion repository with Ant, I guess there should be no problem to do it for CVS
Related
Right now i am using below mentioned cvs command line argument for checking out files from CVS repository.
# Module1_1_20_2017 is the tag name.
#Test/user_Test/work is the module name.
cvs checkout -r Module1_1_20_2017 Test/user_Test/workload
I want contents of this Test/user_Test/workload module to be checked out into a local workspace folder named as work which is located at C:\Jenkins\jobs\workspace\work.
But every time when i use the above command it creates empty directories after this C:\Jenkins\jobs\workspace\work local workspace as C:\Jenkins\jobs\workspace\work\Test\user_Test\workload.
I want to get rid of these entire folders Test\user_Test\workload and after checking out files from Test/user_Test/work this module the local workspace should look like C:\Jenkins\jobs\workspace\work (not C:\Jenkins\jobs\workspace\work\Test\user_Test\workload) and this local workspace C:\Jenkins\jobs\workspace\work should contain all the files of this Test/user_Test/workload module.
What cvs command line will satisfy this requirement?In short I want to create a local name as in jenkins job configuration shown in the picture attached below.
Use the form cvs checkout -d <path> <module>.
In your case that is cvs checkout -d work Test/user_Test/workload
(Did cvs checkout --help not give you this answer?)
I have deployed a war file in a remote machine using Jenkins. Now I want to rename the war file through jenkins before it extracts the work folder? How can this be done? I tried post deployment action -> execute shell and mv file.war to new-file.war but it returns an error saying : mv: cannot stat `file.war': No such file or directory.
Suppose there was something wrong with my path it would not even have gone to remote location. but for me, after scp' ing it to remote location thru jenkins, and when i try to do a mv, it fails.. What could the reason be??
Adding additional Step of Execute shell during Add build Step or Add post-build action stage, normal renaming shell command mv can be used to rename artifacts.
Note: Make sure use the correct path(Relative to project/workspace root)
Your mv command is probably executed in another directory than the one you are expecting.
To know the directory your script is running in without reading the jenkins / plugin documentation add
echo "pwd of script is: " `pwd`
to your shell script and inspect the output of the jenkins build - that way you can be sure about the directory the script is run in.
How to change directory (CD) using ant script?Is there any task in ant which does:
cd
There is no way to do this in Java.
See Changing the current working directory in Java?
So ant can't do it either.
Current dir can only be changed for nested tasks like java forked in separate process with fork="yes".
I want to checkout a specific folder from deep within a CVS module into my Hudson / Jenkins workspace. Stripping off the other options (such as pruning, branch, etc) the CVS command is ...
cvs checkout -d workspace module\a\b\c\d\e\f
This causes my folder to contain a child folder 'a' and that contains 'b' and that contains ... well you get the idea. All of them are empty until you get down to folder 'f'.
What I'd really like is for myfolder to contain the contents of f. Does CVS support this functionality (without defining f as a module)?
And for bonus karma ... Can I get Jenkins to use this option with a .cvsrc or some other mechanism?
I don't get the behaviour you describe. When I move to an empty directory and do
cvs checkout -d fox modules/a/quick/brown/fox
I just get a new directory called fox containing the contents of the directory I requested. (Note the forward slashes.)
However, if I do
cvs checkout modules/a/quick/brown/fox
then I get what you describe.
I'm using the latest FSF build of CVS on windows, http://ftp.gnu.org/non-gnu/cvs/binary/feature/x86-woe/cvs-1-12-13a.zip .
There is a file called "modules", under your CVSROOT folder.
You can edit it, and a line like the following:
###shortcut name actual path########
f /a/b/c/d/e/f
Check this file back in. Once it sets in, you can just use
cvs checkout -d workspace f
Also, in Hudson, you can (in the Modules(s) ) box, just put f, and it should directly download only f, instead of the entire structure.
Once that is down, you could rename it using a shell/command.
More in General:
Go up 1 level above where you checked out
cvs co -r "TAG"
I'm having some trouble figuring out how to install Ant on Cygwin. I want to use Ant to build Nutch. I've looked through a bunch of tutorials but I can't find anything that is low level enough for me to understand. I need something like...
Download ant, put it here
Open Cygwin
type "export ANT_HOME=..."
...
Can anyone help me out here?
Assuming you have a JDK already installed, you can do this:
$ export ANT_HOME=/cygdrive/c/apache-ant-1.7.1
which assumes you've unzipped Ant into C:\apache-ant-1.7.1. Then:
$ export PATH=$ANT_HOME/bin:$PATH
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
In Windows, add the path to your ant /bin directory to the Path system variable. This can easily be done by right clicking on Computer > Properties > Advanced System Settings > Environment Variables, click on Path in the System Variables, click on Edit and add ; followed by the path to your ant bin directory to the end of the Variable value.
Start or restart Cygwin.
Type ant -version The version should be displayed.
Here's a step-by-step guide:
simply download and unzip ANT binaries say into c:\apache-ant-1.8.1
download and unzip NUTCH sources say into: c:\apache-nutch-1.2
open the command prompt and run the following:
cd c:\apache-nutch-1.2
c:\apache-ant-1.8.1\bin\ant
the same would work from the Bash shell, just use Cygwin-style paths:
cd /cygdrive/c/apache-nutch-1.2
./cygdrive/c/apache-ant-1.8.1/bin/ant
That's it, you will find a new directory build containing the output.
For convenience, you might want to add the Ant bin directory to the PATH environment variable so that you don't have to give the full path each time, but that's optional.
BTW I just did those exact steps, and all went fine.
Finally, follow this tutorial to get started.