Building FAQ ------------ What version of JDK? ^^^^^^^^^^^^^^^^^^^^ Our policy is waiting for the majority of our users before migrating to a new version of the Java language. In general we are held up by the slow migration of Java Enterprise Edition environments such as websphere. GeoTools 29.x uses Java 11. How do I build from source code? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Complete build instructions are provided in the user guide: * :doc:`/build/index` GeoTools makes use of the Maven build system (in part to help us reused code from a number of other Java projects). To build all the modules:: mvn install -Dall To load the modules into the eclipse IDE. 1. Use :menuselection:`Windows --> Preferences` to open the Preference Dialog. Using the tree on the left navigate to the Java > Build path > Classpath Variables preference Page. 2. Add an **M2_REPO** classpath variable pointing to your local repository where maven downloads jars. ================== ======================================================== PLATFORM LOCAL REPOSITORY ================== ======================================================== Windows XP: :file:`C:\\Documents and Settings\\Jody\\.m2\\repository` Windows: :file:`C:\\Users\\Jody\.m2\\repository` Linux and Mac: :file:`~/.m2/repository` ================== ======================================================== 2. Generate the ``.project`` and ``.classpath`` files needed for eclipse:: mvn eclipse:eclipse -Dall 4. You can now use the eclipse import wizard to load existing projects. Why is Maven 3 Slower? ^^^^^^^^^^^^^^^^^^^^^^ Maven 3 is not faster out of the box with the default settings. However what is new is that you can ask it to use more than one core:: mvn install -Dall -T 2C The above asks the build to go in "threaded" mode; using two threads for each core. What the fastest build? ^^^^^^^^^^^^^^^^^^^^^^^ This is the fastest build on my machine:: mvn install -DskipTests -o -T 2C The above options: + install (without clean) only re-compiles modified code + no profiles or flags are used to build optional code; only the core library is built + ``skipTests`` - the tests are still built; they are just not run + ``o`` - allows the build to work "offline" (thus no external servers are checked during the build) + T 2C - builds with two threads per core I use this configuration to quickly push all local changes into my local maven repository so I can test in a downstream application such as uDig or GeoServer. How do I create an executable jar for my GeoTools app? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you're familiar with Maven you might have used the `assembly plugin `_ to create self-contained, executable jars. The bad news is that this generally won't work with GeoTools. The problem is that GeoTools modules often define one or more files in its ``META-INF/services`` directory with the same names as files defined in other modules. The assembly plugin just copies files with the same name over the top of each other rather than merging their contents. The good news is that the `Maven shade plugin `_ can be used instead and it will correctly merge the ``META-INF/services`` files from each of the GeoTools modules used by your application. The pom below will create an executable jar for the GeoTools :doc:`/tutorial/quickstart/index` module which includes all of the required GeoTools modules and their dependencies. .. sourcecode:: xml 4.0.0 org.geotools.demo quickstart jar 1.0 GeoTools Quickstart example http://geotools.org 14.1 maven-compiler-plugin UTF-8 11 11 org.apache.maven.plugins maven-shade-plugin 3.5.1 package shade *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA true shaded org.geotools.demo.Quickstart org.geotools gt-shapefile ${geotools.version} org.geotools gt-epsg-hsql ${geotools.version} org.geotools gt-swing ${geotools.version} junit junit 4.5 test