Development¶
You are encouraged to help contribute code to GeoWebCache. To do so, you will first need to set up the proper development environment.
This is the current prerequisites:
Please make sure you use Java 1.5 to compile to ensure that we do not introduce dependencies only available in 1.6.
You are encouraged to join the GeoWebCache Developers mailing list to discuss your work. It is always a good idea to ask whether anyone else has already solved the same problem.
Setting Up¶
The Maven build system respects the current setting of JAVA_HOME.
To define JAVA_HOME be sure to point to the root directory of your JDK.
Windows:
set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_21
Linux/OS X:
export JAVA_HOME=/opt/jdk1.5.0_21
You can download maven from http://maven.apache.org/download.html, unpack and include the
bin
directory in your PATH variable.Windows:
set M2_HOME = C:\java\apache-maven-3.0.5 set PATH=%PATH%;%M2_HOME%\bin;%JAVA_HOME%\bin
Linux:
export M2_HOME = ~/java/apache-maven-3.0.5 export PATH=$PATH:$M2_HOME/bin:$JAVA_HOME/bin
For more detail instructions on maven see the download page.
Test that Maven is installed correctly:
mvn -version
Check that you are using the right version of the
javac
compiler (as this is determined byPATH
, notJAVA_HOME
):javac -version
Build¶
Check out the code:
mkdir gwc cd gwc git clone https://github.com/GeoWebCache/geowebcache.git
To build the code, enter the
geowebcache
directory and run:cd geowebcache mvn clean install
To quickly run a local GeoWebCache for testing:
cd web mvn jetty:run
A WAR is built as the last step in
mvn clean install
above.It is located in
geowebcache/web/target/geowebcache.war
Setting up Eclipse¶
Inside the source code directory, run:
cd geowebcache mvn eclipse:eclipse
This generates the
.project
and.classpath
files used to define an Eclipse project.Create a new workspace in Eclipse
Configure the Maven repository
Navigate to
Add a new variable M2_REPO, and set the path to
.m2/repository
in your home directory as shown below:System PATH Windows C:\\Users\You\.m2\repository
Linux or Mac ~/.m2/repository
Next we will configure Eclipse for working on GeoWebCache files.
- Navigate to to .
- Click on Import, choose
geowebcache/tools/formatter.xml
There is also a
geowebcache/tools/codetemplates.xml
to assist with creating new files.Now we need to import the actual project:
- Open the appropriate wizard menuselection:File –> Import –> Existing Projects into Workspace
- Choose your
geowebcache
folder
This step depends on the
.project
and.classpath
files generated bymvn eclipse:eclipse
above.To run GeoWebCache use the main menu
and double-click on Java Configurations- Set Name:
GWC
- The Project:
geowebcache
- For main class, set Start
Then press Close, or Debug if you want to try it right away.
- Set Name:
Contributing patches¶
The prefered way of providing patches is to create an issue in GitHub a patch, which you create by running:
git diff > patch.txt
In addition to creating the issue, you are highly encouraged to jump on the GeoWebCache Developers mailing list to introduce the patch.