2013-07-09 7 views
1

저는 처음으로 Maven을 사용하고 있습니다. 나는 "GeoTools"(http://www.geotools.org/)를 만들려고하고 있는데, 겉보기에는 잘 설명되어있는 "Getting Started"페이지가 있습니다. NetBeans 7.3.1을 사용하고 있습니다. 내 프로젝트를 빌드 할 때 나는 "빌드 실패"를 얻을 :프로젝트에서 목표를 실행하지 못했습니다.

Failed to execute goal on project tutorial: Could not resolve dependencies for project org.geotools:tutorial:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.geotools:gt-shapefile:jar:10-SNAPSHOT, org.geotools:gt-swing:jar:10-SNAPSHOT: Failure to find org.geotools:gt-shapefile:jar:10-SNAPSHOT in http://download.java.net/maven/2 was cached in the local repository, resolution will not be reattempted until the update interval of maven2-repository.dev.java.net has elapsed or updates are forced -> [Help 1] 

To see the full stack trace of the errors, re-run Maven with the -e switch. 
Re-run Maven using the -X switch to enable full debug logging. 

나는 그게 무슨 뜻인지 정말 모르겠어요. 필자는 코드에 pom.xml 지침을 따라했지만 여러 가지 가져 오기가 존재하지 않는다고 생각합니다. 예를 들어 위의 읽기를 가지고

import org.geotools.data.FileDataStore;

오류 말에 밑줄 :

package org.geotools.data does not exist 

것은 여기 내 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>0.0.1-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>10-SNAPSHOT</geotools.version> 
</properties> 
<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</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-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> 
</repositories> 

누군가 나에게이 도구를 실행을 얻기 위해 몇 가지 조언을 줄 수 있습니까? 근본적인 Maven 오류가 발생 했나요 아니면 도구 관련 문제일까요? JAR 파일은 "종속성"아래에 표시되므로 문제가있는 이유를 알 수 없습니다.

미리 감사드립니다.

답변

2

실제 답변은 GeoTools 자습서가 유해하다는 것입니다. 그래서 미래의 낙오자가이 사실을 알게되면 NetBeans 튜토리얼 (그리고 필자도 역시 실패한 Eclipse 튜토리얼)에서 pom.xml을 설정하는 방법을 정의하는 단계가 있습니다. 그들을 따라가. 그러나 전체 pom.xml 파일을 복사하여 붙여 넣지 마십시오. 어딘가에 오류가 있습니다. 난 단지 의존성과 저장소를 추가하고 프로젝트를 성공적으로 구축했습니다.

하지만 더 기다려주세요. 프로젝트를 빌드 한 후 제공하는 Quickstart.java 예제를 실행할 수 없었습니다.

JMapFrame.showMap(map) 

만 문서는 "사용되지 않는"호출 "MapContext"유형을 받아들이 때문에 추락했다. 그래서,

org.geotools.map.MapContext

을 수입하고 시스템을 치는

비올라
MapContext map = new MapContext(); 

MapContent map = new MapContent(); 

을 변경했습니다. 개발자가 실제로 자습서를 테스트 해보고 싶습니다.

+1

잘 했어. :) – MaVRoSCy

관련 문제