Building RHQ
 | The steps described below are designed to allow you to quickly build RHQ in as few and easy steps as possible. After you become more familiar with the code base and more proficient with the build system, you should check out our Advanced Build Notes for additional things you will find helpful in working with the RHQ Maven build system. |
 | IDE Development If you want to develop the RHQ platform, you can load the codebase in your favorite IDE. We have some tips for the following development IDEs:
|
To build RHQ from source and get it up and running, follow the below steps:
Install JDK 5
- Download the latest release of JDK 5 from http://java.sun.com/javase/downloads/index_jdk5.jsp.
- Install it as described here: http://java.sun.com/j2se/1.5.0/install.html
- Set the following environment variables in your .profile (UNIX) or System environment (Windows):
- JAVA_HOME=JDK5_install_dir
- PATH=$JAVA_HOME/bin:existing_PATH
Install Maven 2
- Download the latest release of Maven 2 from http://maven.apache.org/download.html.
- Unzip it somewhere on your system (e.g. C:\opt).
- Set the following environment variables in your .profile (UNIX) or System environment (Windows):
- M2_HOME=Maven2_install_dir
- MAVEN_OPTS=-Xms128M -Xmx768M
- PATH=$M2_HOME/bin:existing_PATH
Install SVN
Access to the SVN repository can be done via the SVN command line or via a plug-in to your IDE.
To run SVN commands independently of your IDE you can install SVN from subversion.tigris.org.
- Eclipse - Eclipse now hosts the Subversive plug-in which emulates to a great degree the built-in CVS features offered by Eclipse. To install the Eclipse Subversive SVN plug-in follow the Subversive directions here.
- IntelliJ - IntelliJ has built-in support for SVN.
Install and Start PostgreSQL
See our PostgreSQL Quick Start Installation Guide
Checkout RHQ Sources
- Open a command prompt and cd to the directory where you want the RHQ sources to live, e.g.:
- Checkout trunk from the RHQ SVN Repo:
 | If you are on Windows, make sure you do not checkout the RHQ code into a directory with a long path; this will cause errors during the build and startup. |
Build RHQ
- Open a command prompt and cd to the directory where the RHQ sources live, e.g.:
- Build RHQ:
mvn install -Penterprise,dev -Dmaven.test.skip=true -Ddbsetup
- NOTE: The first time you build RHQ, it will take 10-20 minutes, because it will need to download dozens of 3rd party dependency jars for both RHQ and Maven itself. However, subsequent full builds should only take 3-5 minutes, shorter if you perform individual module dev builds.
- NOTE: "-Ddbsetup" is only required the first time you build; thereafter, the schema will be created in your database and you won't need to do it again unless a) the schema changes and needs to be rebuilt or b) you want to clean out your database and rebuild the schema
Run RHQ
- First start the RHQ server, which is built to <rhq-trunk>/modules/enterprise/server/container/target/rhq-server-<version>/bin:
cd <rhq-trunk>/modules/enterprise/server/container/target/rhq-server-<version>/bin
./rhq-server.(sh|bat) start
 | Because you built using the -Pdev Maven profile, you can also run the RHQ Server container that is built to <rhq-trunk>/dev-container. See Advanced Build Notes for more information on the enterprise and dev profiles |
- UNIX NOTE: The build today does not turn on the proper execute bits so first execute the following:
chmod ug+x bin/rhq-server.sh jbossas/bin/run.sh
- Windows NOTE: You may want to use the rhq-server-console.bat script. The rhq-server.bat expects the server to be running as an installed service.
- Next start the RHQ agent, which is built to <rhq-trunk>/modules/enterprise/agent/target/dist/:
cd <rhq-trunk>/modules/enterprise/agent/target/dist/bin
./rhq-agent.(sh|bat)
- Windows NOTE: The agent uses Java preferences which stores settings in the Windows registry. This can cause problems if you, for example, switch IP addresses. To purge the settings run with the -l option.
- Once the RHQ server is fully started, go to http://127.0.0.1:7080/ in a Web browser.
- Login as user rhqadmin, password rhqadmin.
- Once the agent is fully started, a platform should appear in the Autodiscovery portlet on the Dashboard page; import this platform into RHQ's inventory.