Gerald Nunn's Blog
« Yet even more on the WLP ResourceProxyServlet | Main | WebLogic Portal Analytics API »Using Maven and CVS on Windows
Monday, March 17, 2008
I am currently using Maven with CVS on a Microsoft Windows environment and had a minor issue with the Maven changlog plugin. This plugin builds a report from your CVS, or other SCM, repository that displays a list of changes made in the repository.
The issue I had was that this plugin ran fine on the Unix build box but not on my local development station that was running Windows. While not a pressing issue, it was annoying because I could not run the mvn site command locally to test any site changes out. Every time I ran the command I would get an exception about no credential being found. I had run the cvs login command previously but the plugin stubbornly refused to work even though using CVS directly at the command line worked fine. Unfortunately the client does not allow an anonymous user so the only way to get this working is to authenticate successfully.
Turns out the issue is that on Windows I was using the cvsnt binaries and there is one significant difference between CVSNT and CVS with respect to cvs login. Under CVS, when you run the cvs login command, it generates a .cvspass file that is placed in your user directory. The CVSNT binaries though place the credential in the registry. The Maven SCM plugins work with CVS directly and do not use binaries so it expects the standard CVS behavior of using the .cvspass file.
The Maven 1.x changelog plugin did have a way to generate this .cvspass file but this goal does not exist in 2.x. Therefore to generate this file I simply created a quick and dirty ANT build.xml that runs the cvspass task. Here is the build file I created:
<project name="cvspass" default="cvspass">
<target name="cvspass">
<cvspass cvsroot=":pserver:${username}@x.x.x.x/apps/cvs/cvsroot"
password="${password}"
/>
</target>
</project>
The username and password are picked up from the command line when this task is run. Being lazy, I simply run a setDomainEnv.cmd in a WebLogic domain I have lying around to initialize ANT. Afterwards, to run the ANT task simply execute the following at a command line:
ant cvspass -Dusername=xxxxx -Dpassword=xxxxx
With the .cvspass in place the mvn site command now works fine in all locations.
Posted by Gerald Nunn at 4:01 PM | Categories: Java | | | Permalink
