Dashboard > Admin > Home > 02 Development Environment > 09 Libs Refresh.xml Ant Script
Admin
09 Libs Refresh.xml Ant Script
Added by jive , last edited by Jyotirmaya Nanda on Aug 20, 2008  (view change) show comment
Labels: 
(None)

After importing the source code there are a couple of steps to run through for your first build.

This page documents what exists right now - specifically an ant script that uses maven-ant-tasks to download the needed jars. This solution is working very well, but we need your input.

Building for the First Time

In a Perfect World

  1. The net.refractions.udig.libs plugin includes a refresh.xml ant script that is hooked into the build process
  2. Turn on automatic builds
  3. You can watch a script run in the Console. The script will create a lib folder and download a bunch of jars.
  4. Please select the net.refractions.udig.libs project and hit refresh (or F5) - you can check the "Referenced Libraries" and see if all the gt-main, gt-api, etc... jars have actually been downloaded.
  5. If everything worked well uDig will compile

This perfect world has worked for five developers thus far - are you feeling lucky?

If the refresh.xml script failed to find a couple jars (usually from ibliblio) then you will need can try changing copy.properties to use a different mirror - or just run it again until it finds everything.
If something is not compiling it probably means that a new jar is available and we need to make it available to others on the classpath (see the next section)
At the time of writing the net.refractions.udig.libs.source plug-in has compile errors; since we are not running this plug-in please just close that project for now.

Making new Jars available on the Classpath

This procedure uses the plugin/META-INF/MANIFEST.MF file (defined as part of the PDE nature) to generate the .classpath and .project files (used by the Java nature to compile).

  1. Switch to the plugin perspective
  2. Select net.refractions.udig.libs.  Select Project > Clean... from the menu.
  3. When presented with the Clean dialog ensure the libs plug-in has a check mark
  4. As part of the clean process the refresh.xml script will create a lib folder and download a bunch of open source jars
    • You should see a script check a bunch of dependencies and then download the needed jars
  5. Try the following to make sure the jars are noticed and available
    • Select the libs folder and "refresh"; all known jars will appear under "Referenced Libraries"
  6. If there are any jars listed in the "lib" folder - it means they are just being treated as files - they have not been added to the classpath
    • Go to the MANIFEST.MF "Runtime" tab and add the new jars
    • Save the MANIFEST.MF file; this should update the .classpath, but let us go to the "Overview" tab and click on the Update the classpath link just to be sure.
    • Close the MANIFEST.MF Editor
      (The next step is going to look at all the packages on the classpath and make sure they are "published" for others to make use of - a bug in Eclipse 3.4 prevents this working well when the MANIFEST.MF editor is open)
    • Right click on net.refractions.udig.libs and select PDE Tools > Organize Manifest; this command will fix up your MANIFEST.MF Runtime settings; and recreate the .project and .classpath information
  7. Open the MANIFEST.MF file and check the runtime tab; the packages for the new jars should be listed on the left.
    • If this list is empty; or only contains a few dozen packages; it means your .classpath was not correct when you ran the Organize Manifest wizard - please try again.

You may want to open up the MANIFEST.MF editor and check the "runtime" tab to see that all the download jars are mentioned.

If the refresh.xml script failed to find a couple jars (usually from ibliblio) then you will need can try changing copy.properties to use a different mirror - or just run it again until it finds everything.

Running the Refresh.xml script by Hand

  1. Choose your target
    • clean: removes the lib folder
    • refresh: will create the lib folder if needed; and will use maven dependencies to download any needed jars
      (This is the default taget)
  2. Select the lib folder and press F5 to refresh

When you run the refresh script by hand Eclipse does not know to "refresh" the modified lib folder.

You can also run the refresh.xml ant targets by hand:

  1. Switch to the plugin perspective
  2. In the Package Explorer, open up Plugins>net.refractions.udig.libs and select refresh.xml
  3. In the outline view select a target to run:
    • build - will create the lib directory and download the jars from the maven repositories defined in copy.properties
    • clean - will delete the lib directory
  4. Right click on the target and Run as an Ant Build
  5. Right click the net.refractions.udig.libs plugin and press refresh
    (This should allow Eclipse to see the recently downloaded jars )
  6. Right click inside the Package Explorer window
  7. Select "PDE Tools" and "Orgnize Manifiest"
  8. Press Finish to fix up the MANIFEST.MF Runtime information and .project and .classpath

Build Advice

The copy.properties file contains the URLs to check when downloading stuff. By default the copy.properties file refers to a couple of servers in North America.

Working on GeoAPI and GeoTools Locally

You will need to run the refresh.xml script; by hand; after each "mvn clean install" in order for uDig to pick up the new jars. Right now the refresh.xml script checks the local repository and the remote repository and makes use of the latest.

To quickly work on only local content:

  1. Open up HOME/.m2/settings.xml
  2. Add the following line
    <settings>
       <offline>true</offline>
    </settings>
  3. The refresh.xml script will notice this change and will only make use of the local repository; this is similar to doing a "mvn clean install -o" on the command line when building geotools.

Outside of North America

If you are in Europe we recommend switching to maven.geotools.fr; you may also wish to list a couple of ibiblio mirrors closer to your location (or even on your LAN):

# Update URL used to fetch GeoTools jars
updateURL=http://lists.refractions.net/m2
# updateURL=http://maven.geotools.fr/repository/

# Ibiblio Mirrors used to fetch Apache jars
mirror1=http://www.ibiblio.org/maven
mirror2=ftp://ibiblio.org/pub/packages/maven2

# Your local repository
repo=file:///${user.home}/.m2/repository
...

If you have difficulty with this step please check out:


Previous: 08 Importing the Source Code Next: 10 Running the Main Application

After the download of the libs, I have a bunch of errors in my libs plugin:

  1. the geotools libs were not added to the build path, had to do that manually
  2. some of the entries in MANIFEST.MF refer to folders that do not exist, they have to be removed:
    net,
    net.refractions,
    net.refractions.udig,
    net.refractions.udig.libs
  3.  lib/geoapi-2.2-M0.jar is not added to the classpath, which results in errors in the MANIFEST.MF
Posted by Andrea Antonello at May 16, 2008 15:54Updated by Andrea Antonello
Powered by a free Atlassian Confluence Open Source Project License granted to uDig. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators
User-friendly Desktop Internet GIS