August 13, 2007
Contributed by Pedro Alves, Pentaho Community Member
Community Build Framework
This is a deprecated version. Please check the main page here
Like many others, I had a hard time installing and setting up a development environment for pentaho. I had some requirements and I think I managed to get a good approach. This were my premises:
- I needed to know how to build a demo solution that connects to an arbitrary database and shows simple pentaho abilities in the least possible time (eg: have a demo set in 2 hours in a client's database)
- I need to switch configuration on the fly so that I can switch from different scenarios (eg: from client A to client B)
- I don't want to change any original files that could get overwritten in a upgrade
- the platform upgrade must be easy to do and not break the rest of the setup
- Debug is a "must have"
- Must support all kinds of different customization in different projects, from using a different databases (I'm using postgresql , thanks elassad) to different security types.
- decided to use not the pre-compiled binaries but the sources from svn, as described here: http://wiki.pentaho.org/display/Pent...o+with+Eclipse
Project pentaho already has a good dev_build.xml ant script, but it wasn't enough for my needs, since I needed to change the svn sources in order to configure a solution. So I built my own structure, and its like this:
pentaho* directories are cheched out from svn, and for me are read-only. Feel free to use any svn client you want; I usually work in linux, or on a windows machine with cygwin, so I use the original client. I checked out the sources with:
If you are under a proxy you can use http:// instead of svn:// . I'm currently using version 1.7 (this one, or later, is required for tomcat support)
target-* directories are the ones generated by the build script. I don't use target-solutions at all (honestly, I'm not sure what this are for, cause they seem a copy of pentaho-solutions. Guess the point is to pick target* and copy it, w/o any other dependencies, to the desired machine). target-build is the temporary build directory. Since we may need to patch the pentaho source, we'll make an entire copy of pentaho/ to target-build and patch the later, leaving the original source intact.
This leaves us with the "project-client" directory. As I mentioned before, I don't want to write anything under pentaho* directories, so all my changes go to this directory. Here is the structure in more detail:
The idea is very simple: All changes that I would normally do under pentaho* I put them under "patches" directory. My top level ant script just picks them and copies the files to the top level directory. It's recommended to patch pentaho* as least as possible because we are actually overwriting the source files, but the file override.properties is meant to be changed. All other changes are made by patching the final directory, target-preconfiguredinstall. (I use a target-preconfiguredinstall-tomcat for tomcat, but that is configurable)
For my first scenario, those were the files I had to change. I had to change some jboss's config files just because I had to change a port that was unavailable; added my datasource (client-ds.xml) and changed the jboss-web.xml and web.xml to register it; changed all other ds's cause I'm using postgresql instead of hsql; added the jdbc lib; changed the security system from memory to jdbc.
This is scalable. Just change files there and they will be copied to the destination target. My ant file does not allow (yet) to remove files from target to destination, but I also don't think thats a relevant issue.
The solution is under project-client/solution, and override.properties points to this dir. For now, I just copied pentaho-solutions to here, and will start from there by adding new solutions and playing a bit.
Tip: Since project-client/solution/system is a generally untouched directory, it's easier to maintain the svn info there. Just copying the directory from pentaho-solutions/system or making a
will allow svn updates later. The same approach can be used for _admin, __samples_ and _test_ directories.
To extend customization to a greater extent, I've implemented some filter tokens for some common changeable attributes, such as database locations and passwords. For instance, instead of writing the database location I write (DB_LOCATION) and the correct value is replaced at compile time.
This is the top level build.xml file. Very simple, indeed:
and this is my build.properties file
How to build this? Simple: 'ant dist-clean' to delete all compiled classes and delete target* directories, and 'ant all' to build everything.
You may need to change some entries in override.properties to support tomcat instead of jboss, mainly:
If we had another project in a directory called 'project-anotherclient', all we had to do was to simply change build.properties file and change project entry from client to another client and with a 'ant clean all' we would have a clean solution with totally different configuration
There is an extra file there, called 'updateall-svn.sh'. Its just a simple bash script to update all sources from svn. It will only work on some systems:
At this point, all that was missing was the design studio and knowing how to debug the platform. I'm a netbeans user, so eclipse was totally new for me and I was a bit lost. Since I usually work with tomcat, debugging jboss was also a new area.
I tried, and tried, and tried once again to build designstudio from sources, but I could not do it. there are 3 projects on the svn root, but failed miserable in all of them. So I went to the precompiled plug in; There is a tutorial here that shows how to use jbossIDE to do the debug jboss, but I found that a bit complicated for 2 reasons: 1 - I could not get designstudio plugin to work in the same eclipse instance as jbosside plugin; 2 - I'm used to do debugging just by attaching a debugger to a socket, so using a >100 Mb plugin just for debugging seemed to me a great overhead. So I opted by not using jbosside plugin. This is what I did:
1 - Downloaded and installed (unzipped) the latest eclipse
2 - downloaded design studio pre-compiled plug ins and unzipped it to the eclipse directory (starting with eclipse -clean may be necessary)
3 - copied file pentaho-preconfiguredinstall/bin/run.conf to project-client/patches/target-preconfiguredinstall/bin/run.conf and uncomment the line that says:
You can also change other attributes as needed, such as memory limits. For tomcat check catalina.sh file for instructions
4 - run eclipse, added a project named project-client, and a java project (with existing ant script) for pentaho/dev_script.xml.
And that was it. If I want to work on my xactions I just use "project client", if I need to debug jboss I just need to start it with 'debug.(bat|sh)' and attach the eclipse debugger to it (click debug, choose 'debug remote application' and point to the correct host, port 8787 as the above example). Breakpoints will work as magic
This is my 2 cents in appreciation for the great effort pentaho team puts in this project, and their courage to go for an open-source approach.
Thread sponsored by irc channel ##pentaho in freenode