Building deegree 3 from SVN with Maven
This page describes the building of deegree3 by using Maven (and the supplied Maven 2 POMs). For a description of setting up deegree3 in Eclipse please take a look at BuildingWithEclipse.
1. Prerequisites
- Sun Java SDK 1.6 (Update 4 or later is required, because deegree 3 depends on JAXB 2.1 API)
you may check the Java version on your system using java -version on the command line
make sure to at least set JAVA_HOME to the right location (something like: export JAVA_HOME=/usr/lib/jvm/java-6-sun)
Maven 2 (version 2.2.1 is tested/recommended), see http://maven.apache.org/download.html for download / installation instructions
- SVN client
2. Check out the deegree modules from SVN
At the moment, it's best to simply check out all deegree 3 SVN modules into a working directory. Below you find scripts that perform this task automatically.
2.1. Windows
Make sure you have installed the svn command-line client and set up your PATH environment variable accordingly. You may use the installer provided by CollabNet which does this automatically.
2.1.1. Anonymous access
Download the batch script below (checkout_deegree3.bat) into a working directory of your choice. Use the windows command line to change to the directory and execute the script by entering
checkout_deegree3.bat
Batch script: checkout_deegree3.bat
2.1.2. Developer access
TBD
2.2. Unix (Linux/BSD/Mac OS X/...)
Make sure you have installed the svn command-line client.
2.2.1. Anonymous access
Download the shell script below (checkout_deegree3.sh) into a working directory of your choice. Use a shell to change to change to the directory of your choice and execute the script by entering
sh checkout_deegree3.sh
Shell script: checkout_deegree3.sh
2.2.2. Developer access
Download the shell script below (checkout_deegree3_developer.sh) into a working directory of your choice. Use a shell to change to the directory and execute the script by entering
sh checkout_deegree3_developer.sh $SVNUSERNAME
Shell script: checkout_deegree3_developer.sh
3. Invoking the build of a module
- Change to the directory of the module you want to build, e.g. deegree-core.
Execute "mvn install", this will compile the module, create a JAR file and deploy it into the local Maven repository on your machine (on UNIX: ~/.m2/repository, on Windows: C:\Documents and Settings\<user>\.m2\repository, on Windows C:\Users\<user>\.m2\repository).
- If you want to build a module that depends on other modules (e.g. deegree-services, which depends on deegree-core), you usually want to build the dependencies beforehand, otherwise the used version of the dependent module will not be identical to your local copy, but fetched from deegree's artifact repository.
For further information on using Maven, please refer to the Maven documentation available online, e.g. http://maven.apache.org/run-maven/index.html#Quick_Start
4. Troubleshooting
4.1. Maven fails to download dependencies / plugins
If Maven fails to download any modules/plugins, you may not have direct internet access and need to set up Maven's proxy configuration: http://maven.apache.org/guides/mini/guide-proxies.html
4.2. Compilation errors
If building a deegree module fails with compile errors, the dependent deegree module snapshots in your local Maven repository may be outdated. E.g. when you build deegree-tools, it depends on snapshots of deegree-core and deegree-services. These are taken from the repository folder. The default settings are:
on UNIX: ~/.m2/repository,
on Windows XP: C:\Documents and Settings\<user>\.m2\repository,
on Windows Vista: C:\Users\<user>\.m2\repository .
If the core/service snapshots here are outdated, you will get compile/runtime errors. In order to provide up-to-date versions of the dependent JARs, you need to "mvn install" for every deegree module in the following order:
- deegree-core
- deegree-services
- deegree-tools
- deegree-test
Also don't forget to do an "svn update" for every module so you have the latest version.
4.3. Test errors
If building a deegree module fails because of errors in the test phase, you may use
mvn -!DskipTests=true install
instead of
mvn install
to skip the test phase.
4.4. Compilation errors in eclipse after an svn update
After an svn update of your deegree code, your eclipse project does not build anymore. Typical error messages are, SomeClass can not be resolved to a type, or some method can not be resolved.
In general there are two reasons for this error:
One of the deegree core developers forgot to check in his / her modifications, resulting in a missing method/class exception. You can verify if this cause applies by checking the nightly builds of deegree if the module (for example deegree-core) you are interested in did not build as well you know there is nothing you can do. Solution Update your code a little later again, maybe drop in a note on the deegree-users list.
Some dependency (e.g a library, a piece of 'generated-code' (e.g modified jaxb configuration beans)...) has changed for this deegree-module. Eclipse will not know these changes from a mere svn update, hence you must make it aware. Solution do a
mvn eclipse:clean eclipse:eclipse
in the broken module (see Creating an Eclipse project workspace from a module for more information). If (after a refresh) eclipse does still not build, check if some other (dependent) deegree-module changed as well (and do the above). If it still does not work, please drop in a line at the deegree-users list.
5. Creating an Eclipse project workspace from a module
- Change to the directory of the module on the command line, e.g. deegree-core
- Execute
mvn eclipse:eclipse
this will generate new .classpath and .project files (which are used by Eclipse to set up the build path)
- In Eclipse, create a new Java project based on the module directory.
Build path settings are adjusted automatically, except for the variable M2REPO. See deegree3/SettingMavenVariableInEclipse for a step-by-step guide to fix this.
If you set up all dependent modules as Eclipse projects as well, your module should build without problems. However, if you experience that Eclipse doesn't seem to build, you may need to select "Project" -> "Clean" or "Project" -> "Build Project" manually.
Don't hesitate to ask on the deegree-users list if you run into any problems. See GettingInvolved#MailingLists
