Software Development

Sunday, February 17, 2008

Adding CruiseControl and Netbeans to the mix



Software:
  • CruiseControl 2.7.1
  • JDK 1.5.0.13
  • SvnAnt 1.0.0

Steps:
  • Install JDK (ensure JAVA_HOME is set to the JDK home)
  • Install CruiseControl
  • Download and unzip SvnAnt 1.0.0
    • Copy the /lib/*.jar to /lib folder of Ant
Configure:
  • I already has a c;\projects folder to keep all my SVN repo, Trac projects, so I will create a c:\projects\cruisecontrol
  • the connectfour is a sample project that comes with CC, I will copy it over to my own
    • I need to copy over 2 things from C:\Program Files\CruiseControl:
      • projects folder and config.xml to c:\projects\cruisecontrol
    • CC comes with ant-1.7.0, so i also need to edit config.xml to change the antHome from relative path to absolute path.
    • I will also create a bat file c:\projects\cruisecontrol folder to execute the cruisecontrol.bat that is under the C:\Program Files\CruiseControl. This is required because CC will read the config.xml in the path that it is currently executing to get the configuration.
    • Create a cc-build.xml under the c:\projects\cruisecontrol\my-project folder. This is to set the local folder up for checking out the source codes from SVN repo. CC does not checkout the codes for you, so we need to use SVNANT to do it.
  • The last part: what to build?
    • Well, my java project is created using Netbeans, which uses a build.xml which can be consumed by Ant. I simply checkout my Netbeans project sources, inside my cc-build.xml, point ant's target to the build.xml and it will compile the project without me changing the build.xnl at all.
    • The build.xml without modification, will of course output the class and jar files into the dist and build folder (as in Netbeans), if you want to change it, you will have to modify build files (dont ask me, i don't know how)
cc-build.xml




























${cp}


  1. If your project source codes is large, you will not want to checkout everything whenever you want to build. Most likely, you will want to use Update instead. To do this, I added in an Ant target to check if the .svn folder exists in the source folder. If it doesn't, Ant will do a full checkout, else it will do an update.

config.xml
 





























  1. To change CC to run the cc-build.xml:
        




  2. To merge the Unit test results from the build.xml:
        



  3. To point the Artifact folder correctly, change:
        










Sunday, February 10, 2008

What to learn?



Development libraries
Spring
Struts 1 - completing
Struts 2 - to do at least one sample app
JSF
Hibernate 3 - started
JEE - started
Maven
GWT
Rails
Groovy - started
Grails - started


Development tools
  • CI
    • CruiseControl
    • Hudson
  • Coverage
    • Cobertura
  • Trac - started

Tuesday, February 05, 2008

Setting up a build server with SVN, Trac and Apache



Install


  • apache_2.0.63-win32-x86-openssl-0.9.7m.msi
  • svn-1.4.2-setup.exe
  • python-2.5.1.msi
  • setuptools-0.6c7.win32-py2.5.exe
  • Genshi-0.4.4.win32.exe
  • Trac-0.11b1.win32.exe
  • svn-python-1.4.6.win32-py2.5.exe
  • mod_python-3.3.1.win32-py2.5.exe (Apache2.0)


Reference

  • http://www.subversionary.org/howto/setting-up-a-server-on-windows
  • http://trac.edgewall.org/wiki/TracOnWindows#InitializeanewTracprojectenvironment:
  • http://trac.edgewall.org/wiki/TracModPython


Security

C:\> mkdir c:\passwd
C:\> "c:\Program Files\Apache Group\Apache2\bin\htpasswd.exe" -c c:\passwd\passwords username
Automatically using MD5 format.
New password: *******
Re-type new password: *******
Adding password for user username

C:\> cd C:\Python25\Scripts
C:\Python25\Scripts>trac-admin c:\projects\trac\my-project
Trac [c:\projects\trac\my-project]>permission add developer WIKI_ADMIN
Trac [c:\projects\trac\my-project]>add developer REPORT_ADMIN
Trac [c:\projects\trac\my-project]>permission add developer REPORT_ADMIN
Trac [c:\projects\trac\my-project]>permission add developer TICKET_MODIFY
Trac [c:\projects\trac\my-project]>permission add username developer

Subversion

md c:\projects
cd c:\projects
md c:\projects\svn
svnadmin create c:\projects\svn\my-project

Trac
md c:\projects\trac
c:\Python25\Scripts\trac-admin.exe c:\projects\trac\my-project initenv
Project Name [My Project]>TestTrac
Database connecting string [sqlite:db/trac.db]> [ENTER]
Repository type [svn]>[ENTER]
Path to repository [/path/to/repos]>c:/projects/svn/my-project
Template directory [C:\Python25\share\trac\templates]>[ENTER]



httpd.conf
SVN:
LoadModule dav_fs_module modules/mod_dav_fs.so


DAV svn
SVNPath C:\projects\svn\my-project
AuthType Basic
AuthName "Trac/Subversion Repository"
AuthUserFile c:\passwd\passwords
Require valid-user




TRAC:
LoadModule python_module modules/mod_python.so



SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv c:/projects/trac/my-project
PythonOption TracUriRoot /trac/my-project

AuthType Basic
AuthName "Trac/Subversion Repository"
AuthUserFile c:\passwd\passwords
Require valid-user