Project Wiki
Views

BuildingSourceCode

From Wiki

Jump to: navigation, search

Building JasperReports Server Source Code

Here is a set of instructions on how to build JasperReports Server source code.

You can also refer to the JasperReports Server Source Build Guide PDF for additional information. The most current Source Build Guide can be downloaded from the downloads area (click the Release menu item).


Getting Source from Public SVN

You can check out the HEAD source code using the Subversion source versioning client.

You can checkout source with a Subversion command such as the following.

To get a tagged source revision (for instance)

  svn checkout --username anonsvn --password anonsvn
      http://jasperforge.org/svn/repos/jasperserver/tags/js-4.0.0  jasperserver

To get the trunk source:

  svn checkout --username anonsvn --password anonsvn
      http://jasperforge.org/svn/repos/jasperserver/trunk jasperserver


Example Source Code Checkout

On your local system, create a folder to hold your JasperReports Server source files.

Linux example:

cd /home/user
mkdir js-builds
mkdir js-builds/tags
cd js-builds/tags

Windows example:

cd c:\
mkdir js-builds
mkdir js-bulds\tags
cd js-builds\tags

Checkout the source code:

svn co --username anonsvn --password anonsvn
    http://jasperforge.org/svn/repos/jasperserver/tags/js-4.0.0  jasperserver


Getting Source from the Downloads Area

For major releases, we include a source code package as a zip file. You can check the downloads area and look for a file like jasperserver-cp-<ver>-src.zip. (Click the Release menu item for the downloads area.)

4.0.0 was a major release (in the way we prepared and managed this release).

4.1.0 will be minor release.


Setting up to Build Source

To build and deploy JasperReports Server, you will need to following tools:

  • Java JDK 1.5 or 1.6
  • Apache Ant 1.8.1
  • Maven Build tool
  • Application Server (ie Tomcat)
  • Database (ie MySQL)

So, install Java, Ant, Maven, Tomcat, and MySQL onto your local environment.

You can check that the main components are setup ok by running the following:

  • java -version
  • ant -version
  • mvn -version


Prepare to Build Source

The JasperReports Server source code comes with a set of Ant scripts that can automatically configure the JasperReports Server source build with a single property file. These Ant scripts are known as the Buildomatic scripts.

First you will need to get your Buildomatic master properties file in place.

You will need to copy a *sample* master.properties file and rename it for your usage.

There are two sample to use:

  • source-mysql_master.properties
  • source-postgresql_master.properties

Example copy/rename:

cd js-builds/tags/jasperserver/buildomatic

cp sample_conf/source-mysql_master.properties  default_master.properties

(Note the file should be named "default_master.properties")


Edit your default_master.properties File

You will need to add your own local settings to the default_master.properties file.

Example Settings:


cd js-builds/tags/jasperserver/buildomatic

edit default_master.properties

appServerType = tomcat6

appServerDir = /home/user/apache-tomcat-6.0.26

dbHost = localhost

dbUsername = root

dbPassword = password

maven = /usr/bin/mvn

js-path = /home/user/js-builds/tags/jasperserver

Take a look at the JasperReports Server Source Build Guide pdf for more examples and settings.


Update your Ant Installation!

The buildomatic scripts depend on the additional ant module: ant-contrib-<ver>.jar

You will need to copy it to your ant/lib folder.

cp buildomatic/install_resource/extra-jars/ant-contrib-1.0b3.jar

to your ant/lib location, such as:

/home/user/apache-ant-1.8.1/lib


Build and Deploy JasperReports Server

Note: If you would like to run the unit-tests, you will need to create the sample databases "foodmart" and "sugarcrm" (included in steps below).

Note: You should have your database running in order to execute the unit-tests.

Note: You should have your app server turned off before you deploy JasperReports Server.

cd <js-src>/jasperserver/buildomatic

ant add-jdbc-driver

ant build-ce

ant create-js-db

ant create-sugarcrm-db      (for sample data)

ant load-sugarcrm-db        (for sample data)

ant create-foodmart-db      (for sample data)

ant load-foodmart-db        (for sample data)

ant update-foodmart-db      (for sample data)

ant build-js-ddl-ce

ant init-js-db-ce           (add schema to database)

ant run-unit-test-ce        (run tests, add core and sample data to DB - depends on sample DBs)

ant deploy-webapp-ce        (deploy jasperReports server to your app server)


Troubleshooting Problems

You can take a look at the Trouble-Shooting Appendix C in the JasperReports Server Source Build Guide pdf for helpful hints.

If you have trouble running the unit-tests you can load the "core" data by doing the following:

cd <js-src>/jasperserver/buildomatic

ant import-minimal-ce

And you can even load the sample data this way:

ant import-sample-data-ce


Logging into JasperReports Server

You can now login to JasperReports Server via you web browser.

The default administrator user is the following:

Username:  jasperadmin

Password:  jasperadmin

You can login using the following example URL:

http://localhost:8080/jasperserver


Change Administrator Password

You can change the password for the jasperadmin user by going to:

Manage > Users menu item

Click on the jasperadmin user

click the Edit button, and set the new password


Additional Notes

Buildomatic creates your Maven setup automatically. You can find your maven setup file at the following location:

cd <js-src>/jasperserver/buildomatic/build_conf/default/maven_settings.xml

"build_conf" is the folder that is generated by buildomatic to automatically setup all your properties for jdbc URL, database connections, etc. A number of these configuration files get copied to your application server when the "deploy-webapp-ce" target is executed. Section 4 of the Source Build Guide pdf has more information on how buildomatic works.

If you have a mistake in your default_master.properties, you can edit the file and correct the error (ie incorrect path). Buildomatic will automatically regenerate your "build_conf" set of files next time you run a target.

If you would like to explicitly reset your buildomatic auto-generated config files, you can run the following targets:

cd <js-src>/jasperserver/buildomatic

ant clean-config

ant gen-config


Old Style Maven Build

If you would like to not use buildomatic, and instead setup Maven in it's default manner, you can take a look at the Source Build Guide pdf Section 5 "Configuring the Build Environment Manually".