javamavengeotools

Maven failed to download geotools dependencies


I want to use geotools in my java project, doing something like:

import org.geotools.data.shapefile.ShapefileDataStore;

Tried to add some geotools' required dependecies in my pom.xml file, like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ZJ_raw_to_DB</groupId>
    <artifactId>ZJ_raw_to_DB</artifactId>
    <version>1.0-SNAPSHOT</version>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <geotools.version>19-SNAPSHOT</geotools.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>3.3</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-shapefile</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-swing</artifactId>
            <version>${geotools.version}</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>osgeo</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>http://download.osgeo.org/webdav/geotools/</url>
        </repository>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>boundless</id>
            <name>Boundless Maven Repository</name>
            <url>http://repo.boundlessgeo.com/main</url>
        </repository>
    </repositories>
</project>

However, maven failed to download all the geotools dependencies, I checked the local repository geotools directory, no .jar file there. I followed the answer of this post, but still can't solve it. Could someone tell me how to get these geotools dependencies work?


Solution

  • There is no 19-SNAPSHOT in the repo.

    http://download.osgeo.org/webdav/geotools/org/geotools/gt-shapefile/

    Instead of using SNAPSHOT version , use release version like 19.4

    You can know more about SNAPSHOT version from here