2017-08-03 6 views
1

import org.geotools.data.postgis.WKBReader;を含めてWKBReaderをインポートしようとしています。org.geotools.data.postgisはどこですか?

WKBReaderクラスはorg.geotools.data.postgisaccording to the documentationである必要がありますが、パッケージは利用できません。

私はとpom.xmlにGT-PostGISのリポジトリを追加しようとしました:

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <geotools.version>17.1</geotools.version> 
</properties> 
... 
<dependency> 
    <groupId>org.geotools</groupId> 
    <artifactId>gt-postgis</artifactId> 
    <version>${geotools.version}</version> 
</dependency> 
... 

...しかし、運を持ちます。私はいつものようなエラーを取得:

は、プロジェクトのチュートリアルに目標を実行に失敗しました:プロジェクトorg.geotoolsの依存関係を解決できませんでした:チュートリアル:jarファイル:1.0-SNAPSHOT:org.geotoolsを見つけるために失敗:GT-たPostGIS:jarファイルを:http://download.java.net/maven/2で17.1がローカルリポジトリにキャッシュされたmaven2-repository.dev.java.netの更新間隔が経過しているか、更新が強制されるまでは、解像度が再試行されることはありません - > [ヘルプ1]

私の質問:org.geotools:gt-postgis:jar:17.1はどこですか?

私の完全なのpom.xml:

<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>org.geotools</groupId> 
    <artifactId>tutorial</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>tutorial</name> 
    <url>http://maven.apache.org</url> 

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

    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.11</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.geotools</groupId> 
      <artifactId>gt-shapefile</artifactId> 
      <version>${geotools.version}</version> 
     </dependency> 
     <!--dependency> 
      <groupId>org.geotools</groupId> 
      <artifactId>gt-geojson</artifactId> 
      <version>${geotools.version}</version> 
     </dependency--> 
     <dependency> 
      <groupId>org.geotools</groupId> 
      <artifactId>gt-postgis</artifactId> 
      <version>${geotools.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.geotools</groupId> 
      <artifactId>gt-swing</artifactId> 
      <version>${geotools.version}</version> 
     </dependency> 
    </dependencies> 

    <repositories> 
     <repository> 
      <id>maven2-repository.dev.java.net</id> 
      <name>Java.net repository</name> 
      <url>http://download.java.net/maven/2</url> 
     </repository> 

     <repository> 
      <id>osgeo</id> 
      <name>Open Source Geospatial Foundation Repository</name> 
      <url>http://download.osgeo.org/webdav/geotools/</url> 
     </repository> 

     <repository> <!--Add the snapshot repository here--> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
     <id>opengeo</id> 
     <name>OpenGeo Maven Repository</name> 
     <url>http://repo.opengeo.org</url> 
     </repository> 
    </repositories> 

    <build> 
     <plugins> 
      <plugin> 
       <inherited>true</inherited> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 


     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <configuration> 
       <archive> 
        <manifest> 
         <addClasspath>true</addClasspath> 
         <mainClass>org.geotools.tutorial.quickstart.GeoJson2Shape</mainClass> 
        </manifest> 
       </archive> 
       <descriptorRefs> 
        <descriptorRef>jar-with-dependencies</descriptorRef> 
       </descriptorRefs> 
      </configuration> 
      <executions> 
       <execution> 
        <id>make-my-jar-with-dependencies</id> 
        <phase>package</phase> 
        <goals> 
         <goal>single</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

     </plugins> 
    </build> 
</project> 

MVNログ:あなたがに接続しているリポジトリ

BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.530 s 
[INFO] Finished at: 2017-08-04T12:22:50+02:00 
[INFO] Final Memory: 20M/299M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project tutorial: Compilation failure: Compilation failure: 
[ERROR] /data/osm/maven/geotools/tutorial/src/main/java/org/geotools/tutorial/quickstart/WKB2Shape.java:[30,33] package org.geotools.data.postgis does not exist 
[ERROR] /data/osm/maven/geotools/tutorial/src/main/java/org/geotools/tutorial/quickstart/WKB2Shape.java:[56,9] cannot find symbol 
[ERROR] symbol: class WKBReader 
[ERROR] location: class org.geotools.tutorial.quickstart.WKB2Shape 
[ERROR] /data/osm/maven/geotools/tutorial/src/main/java/org/geotools/tutorial/quickstart/WKB2Shape.java:[56,35] cannot find symbol 
[ERROR] symbol: class WKBReader 
[ERROR] location: class org.geotools.tutorial.quickstart.WKB2Shape 
[ERROR] /data/osm/maven/geotools/tutorial/src/main/java/org/geotools/tutorial/quickstart/WKB2Shape.java:[58,9] cannot find symbol 
[ERROR] symbol: class Geometry 

[ERROR] location: class org.geotools.tutorial.quickstart.WKB2Shape 
+0

私はあなたが間違ったURLを入れて考えてはと交換してみます。http:/ /repo.opengeo.org/そして再度ビルドしてください。私はそれがうまくいくと思います。 –

+0

geotoolsのウェブサイトをチェックしましたか?特にMavenクイックスタートですか? http://docs.geotools.org/latest/userguide/tutorial/quickstart/maven.html –

+0

はい、私はクイックスタートをチェックしました(それをインストールして実行しています) – wambacher

答えて

0

documentationのクイックチェックは、あなたのポンポンに次のように必要示しています

<dependency> 
    <groupId>org.geotools.jdbc</groupId> 
    <artifactId>gt-jdbc-postgis</artifactId> 
    <version>${geotools.version}</version> 
</dependency> 
+0

はい、それは助けました。ありがとう。 – wambacher

+0

upvoteまたは自由に答えを受け入れることができれば –

+0

あなたの担当者を助けるでしょう –

0

?それらの詳細を共有できますか?

この <repository> <id>osgeo</id> <name>Open Source Geospatial Foundation Repository</name> <url>http://download.osgeo.org/webdav/geotools/</url> </repository>

のようなもの
+0

完全なpom.xmlが追加されました – wambacher

+0

mvnログが追加されました – wambacher

+0

がgeojsonに切り替えられました。 – wambacher