We recently revamped our build process, which included separating the production build from our development build, as they satisfy different requirements. In both the 1.2.x and the trunk codelines, the production build uses the build.xml, and when you're developing inside Eclipse, you can use the dev_build.xml.
The dev_build.xml
The build file that you should use to develop with under the latest codeline is the dev_build.xml. This build file is written specifically to accommodate developers that are running and debugging against the preconfigured install JBoss demo server (the pentaho-preconfiguredinstall project contains the shell JBoss server application) or the Tomcat demo server (the pentaho-tomcatpreconfiguredinstall project contain the shell tomcat server application).
The dev_build.xml is dependent on the dev_build.properties file for parameter information. There are several parameters that you may want to override to accommodate your environment. To set these overrides, do not modify the dev_build.properties file! Instead you will want to create an override.properties file and specify your override parameters there. That way, when changes are made to these files, you don't have to merge your changes to the properties.
Contents of override.properties
#if java 1.5 and 1.4 are installed, and java 1.5 is your default, specify java1.4 home
java1.4.home=<your java home>
# override this dir with the real location of your JRE home
jre.dir=<local JRE path>
# override this dir with the real location of your compiler
javac.path=<local javac path>
# database you are using
rdbms = <your database>
target.solutions.dir=<your local path to the target-solutions folder>
solution.path=<your local path to the pentaho-solutions folder>
target.server.dir=<your local path to the target-preconfiguredinstall folder>
source.server.dir=<your local path to the pentaho-preconfiguredinstall folder>
server.dir=<your local path to the target-preconfiguredinstall folder>
solutions.dir=<your local path to the pentaho-solutions folder>
Target: dev-setup (Default)
The default dev-setup target is the target that you should be mainly concerned with if you are planning to using JBoss Application Server. Once you have the source for the four main Pentaho projects, the dev-setup Ant target creates a fully populated, configured and deployed JBoss app server and Pentaho demo application. Here are the steps that the dev-setup performs:
- Compiles all source code
- Creates a pristine copy of the pentaho-preconfiguredinstall project, which is the JBoss app server shell. To customize the location of this copy, set the target.server.dir property in your override.properties file.
- Creates a pristine copy of the pentaho-solutions project, which contains the sample solutions for the PCI demo. To customize the location of this copy, set the target.solutions.dir property in your override.properties file.
- Copies all compiled classes, .war files, datasource configuration files and miscellaneous jars that JBoss needs to run the Pentaho application server to the target server directory.
- Copies the HSQLDB driver jar tot eh pentaho-data project. The pentaho-data project is set up to act as a stand alone database server, which is why the driver jar needs to be accessible in the specified location, so that the startup and shutdown scripts work properly.
- Touches the web.xml file in the pentaho web application, which causes the JBoss server to automatically reload the web application and immediately pick up the changes.
The first time the target is run, all of the above actions are executed, setting up a debuggable environment. On subsequent runs, only modified files are replaced. This target should be run when you have made changes to the source code and you want to test those changes in the JBoss application server.
Target: dev-setup (tomcat)
The dev-setup-tomcat target is the target that you need to use if you are interested ins using tomcat application server. Once you have the source for the four main Pentaho projects, the dev-setup-tomcat Ant target creates a fully populated, configured and deployed tomcat app server and Pentaho demo application. Here are the steps that the dev-setup performs:
- Compiles all source code
- Creates a pristine copy of the pentaho-tomcatpreconfiguredinstall project, which is the Tomcat app server shell. To customize the location of this copy, set the target.server.dir property in your override.properties file.
- Creates a pristine copy of the pentaho-solutions project, which contains the sample solutions for the PCI demo. To customize the location of this copy, set the target.solutions.dir property in your override.properties file.
- Copies all compiled classes, .war files, datasource configuration files and miscellaneous jars that Tomcat needs to run the Pentaho application server to the target server directory.
- This is were you can customize what database you want to use for your PCI. If you override rdbms property in the override.properties it will configure you PCI for that specific database. For example, if you are planning to use hypersonic, then set rdbms to "hsql" in the override.properties. This will copy the HSQLDB driver jar to the pentaho-data project. The pentaho-data project is set up to act as a stand alone database server, which is why the driver jar needs to be accessible in the specified location, so that the startup and shutdown scripts work properly.
- Copy the database specific context.xml to the pentaho/META-INF folder for the jndi settings.
- Touches the web.xml file in the pentaho web application, which causes the Tomcat server to automatically reload the web application and immediately pick up the changes.
The first time the target is run, all of the above actions are executed, setting up a debuggable environment. On subsequent runs, only modified files are replaced. This target should be run when you have made changes to the source code and you want to test those changes in the Tomcat application server.
Target: clean-target-server
The reason the dev_build targets are architected the way they are, is so that you can be sure that your code changes are picked up in the built debugging environment. You also want to be sure that you are working in an environment that is free of residual files being left around from previous runs or builds. The clean-target-server target deletes the entire target server directory, so that the next time dev-setup is run, you once again have a pristine deployment.
Other Important Property Overrides
In order for the build to run successfully in your environment, there may be a couple of other properties you want to add to your override.properties file:
- javac.path - specify the path to your Java compiler (javac.*)
Example: javac.path=d:/tools/j2sdk1.5.0_06/bin/javac - java1.4.home - if you are building the 1.2 version of the platform and 1.5 SDK and 1.4 SDK are installed, and java 1.5 is your default, specify java1.4 home, since the 1.2 version of the platform required SDK 1.4
Example: java1.4.home=D:/tools/j2sdk1.4.2_07
Quick Links For This Document
- 01. Setting Up Your Environment
- 02. Exploring the Pentaho Repository
- 03. Creating Repository Connections
- 04. Checking Out Projects
- 05. Exploring the build.xml
- 06. Debugging with JUnit
- 07. Debugging with the Standalone Platform Project
- 08. Debugging with the JBoss IDE
- Debugging with Tomcat in Eclipse IDE
Note: setting javac.path is not optional. This value must be setup in the override.properties file, otherwise the class files will not be compiled and placed in the war directory underneath target.server.dir . Later, when starting the server as part of 08. Debugging with the JBoss IDE, you'll notice this exception "java.lang.ClassNotFoundException: org.pentaho.core.session.PentahoHttpSessionListener".