One of the most common and misleading errors you will see when building GeoTools is that a jar cannot be downloaded. This error can be given for one of four reasons and only one of them actually means that a jar is missing.
It is important to note that we do not store third-party jars in the SVN repository and we do not include them in snapshots or other src only distributions. However, you do not need to find or install these jars yourself. Maven will download them for you as and when it needs them to complete a build.
With that said, here are the four most common reasons for the error:
1) maven is looking for the jar from a geotools module which failed to build.
GeoTools is divided into a number of modules and plugins, many of which depend on other GeoTools modules. Maven will build all the modules in the right order and, as it completes each one, it will store a jar in a local repository on your machine.
If a module fails to build then any modules which depend on it will also fail. The error message maven gives when this happens is misleading. For example, if the core module fails to build then defaultcore will fail with an error something like:
This is because the main module failed to build and NOT because the jar could not be downloaded.
If maven ever fails with an error like the one above and the jar has the same name as a GeoTools module, then it is probably because that module failed to build. As a general guide, when looking at build errors look for the FIRST thing that went wrong. Start at the top, or look in the buildReport.txt file and see which module failed first. Sucessfull modules should read 'cleaned, compiled, tested, INSTALLED HHMM'
Once you know which module has failed it is a good idea to try and test just that module to find out why. To do so move to the module (or plugin or extention directory) for the part that failed (in the above example 'module/main' and type:
Then study the reports in the target/test-reports directory for that module.
2) You are offline or a repository website is down or congested.
Sometimes, especially during the first few builds when Maven has to download a lot of jars, it fails to make a connection or to completely download some of the jars it needs. This can be especially true if the jars are coming from the SourceForge website as this is often down or very busy. We are working to move all of our remote jars to the ibiblio server which has far more bandwidth available. Your machine may also be offline, but if you are reading this that is unlikely
3) Maven gives an error message about a jar and then seems to download it anyway.
Maven will try a list of web sites (known as remote repositories) until it finds a jar that it is looking for. If the jar is not found at the first site, it will generate an error message before trying the next site. These errors can be ignored unless they are followed by a:
where xyz is NOT the name of a GeoTools module (see reason 1 above).
4) We have deleted the jar or broken the repository where it is supposed to come from.
If you know for sure that the jar is not one that should be built by another GeoTools module, your machine is online, you have tried to build multiple times, and the jar is still not downloading, then it is probably something we have done wrong.
First, locate and open the build.properties file in the module that is failing to build. In this you will find a list of web sites. Try each of these in turn in your web browser to make sure that they are up and browse around to see if you can see where the jar should be. If all the sites are up and you can't find the jar anywhere, let us know on the devel list or file a bug report.
This sometimes happens because not all of the repositories are controlled by us (most common jars like ant, junit etc. come from a repository controlled by the Maven group). Other times it happens because we have done something stupid.
Because Maven only needs to download jars once (it keeps a local copy so it doesn't have to re-download them each time), most developers can go for weeks or months without realizing a jar is missing. If you think this is the case, please let us know. If you don't tell us, we may never spot the problem!