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?
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
Related
I need to work with the Confluence API.
I work with Maven POM but I don't find how to insert the dependencies for the Confluence API.
Can you help me?
What I've already tried:
I need to work with the SpaceManager primaly.
I found this tutorial about managing the pom. So after the tutorial, my pom looks like the following:
<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>***.createspace</groupId>
<artifactId>CreateSpace</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>CreateSpace</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-confluence-plugin</artifactId>
<version>3.2.3</version>
<extensions>true</extensions>
<configuration>
<productVersion>${product.version}</productVersion>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope> <!-- important! -->
</dependency>
</dependencies>
</project>
The *** in the groupId is just to hide my package name of my company.
But also with this pom, I get the error The import com.atlassian cannot be resolved with this import:
import com.atlassian.confluence.spaces.SpaceManager;
So can you help me? Or please tell me what I should add to avoid downvotes, then I hope you see I really searched in the net and need help!
There are instructions how to work with atlassian maven repo Atlassian Maven Repositories and the repo URL is provided: https://maven.atlassian.com/repository/public
<!-- language: xml -->
<repository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
If you're trying to add a plugin for confluence WIKI you'll probably need a dependency to:
<!-- language: xml -->
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
( only once you add the atlassian maven repo to your pom.xml ) so full pom.xml will look like this:
<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.vilutis.lt</groupId>
<artifactId>confluence-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>confluence-plugin</name>
<repositories>
<repository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
</repositories>
<!-- I had to add this section because activation-1.0.2.jar does not exist in public maven repo -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>5.2</version>
</dependency>
</dependencies>
</project>
This config works fine with version 5.2 and the SpaceManager class is accessible in your java code.
I'm not sure with Confluence API implementation you're using. You could try this:
<dependency>
<groupId>org.jvnet.hudson</groupId>
<artifactId>confluence-api</artifactId>
<version>1.0</version>
</dependency>
If you're using an implementation that doesn't support maven builds, then you'll have to add the transitive dependencies yourself.
In this case confluent.version is 3.0.0
<dependency>
<groupId>io.confluent</groupId>
<artifactId>common-config</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>common-utils</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>${confluent.version}</version>
</dependency>
I am new to using Geo Tools and Maven. I'm following the tutorial and came across a specific error. The code I'm trying to run is available here.
My pom.xml is:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.geotools</groupId>
<artifactId>tutorial</artifactId>
<packaging>jar</packaging>
<version>10.0-SNAPSHOT</version>
<name>tutorial</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>10.1</geotools.version>
</properties>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<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>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-grid</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>gov.nist.math</groupId>
<artifactId>jama</artifactId>
<version>1.0.2</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>
</project>
And as I mentioned I am trying to run the same code provided in the above link.
The error I receive is:
line 122: cannot find symbol
symbol: class IntersectionBuilder
location: class org.geotools.grid.GridExamples
Is there a class missing? Any help would be highly appreciated.
I am fairly new to using geotools with maven myself and ran into similar issues recently. If I am not mistaken, gt-grid is an unsupported module. So you might need to download the source and build it in order to use it. I cannot seem to find the GridExamples class at http://svn.osgeo.org/geotools/tags/post-migration/modules/unsupported/grid/src/main/java/org/geotools/grid/
I have found a useful tool to convert .csv files into shape files with geotools:
But I have a problem running it, I get following maven error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
(default-cli) on project tutorial: Command execution failed. Process
exited with an error: 1 (Exit value: 1)
And an error in this line:
final SimpleFeatureType TYPE = DataUtilities.createType(
"Location", // <- the name for our feature type
"location:Point:srid=4326," + // <- the geometry attribute: Point type
"name:String" // <- a String attribute
);
The error:
Exception in thread "main" org.geotools.feature.SchemaException: Error
decoding srs
My POM file is this:
<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>11-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>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven3-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/3</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>
</project>
I am using Maven 3.1 on Win8.1.
I hope someone can help me!
I just had same problem. Maybe this will help someone in the future.
Add this to your pom.xml:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
It appears I have a problem configuring maven in eclipse. i've installed through eclipse marketplace maven for eclipse and maven wtp and it eclipse won't recognize the first line of the POM. not to mention the <packaging>js</packaging> part
the error for the first line:
"Project build error: Unresolveable build extension: Plugin org.codehaus.mojo:javascript-maven-plugin:2.0.0-alpha-1 or one of its dependencies could not be resolved: Could not transfer artifact org.sonatype.aether:aether-util:jar:1.11 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000"
this is the full pom.xml
<?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>www.bgusched.co.il</groupId>
<artifactId>bgusched1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>JavaScript RIA</name>
<packaging>js</packaging>
<description>A JavaScript Rich Internet Application using jQuery and jQuery UI.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.springframework.version>3.0.1.RELAESE</org.springframework.version>
<org.hibernate.version.>3.5.1-Final</org.hibernate.version.>
<gwt.version>2.0.3</gwt.version>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jquery-amd</artifactId>
<version>1.7.1-alpha-1</version>
<type>js</type>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jquery-ui-amd</artifactId>
<version>1.8.16-alpha-1</version>
<type>js</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>$(org.springframework.version)</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>$(org.springframework.version)</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>$(org.hibernate.version)</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>$(org.hibernate.version)</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>$(org.hibernate.version)</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javascript-maven-plugin</artifactId>
<version>2.0.0-alpha-1</version>
</extension>
</extensions>
</build>
<!-- FIXME: Temporary declaration of Codehaus repos until this moves to Maven Central -->
<repositories>
<repository>
<id>JBoss</id>
<name>JBoss Repsitory</name>
<layout>default</layout>
<url>http://repository.jboss.org/maven2</url>
</repository>
<repository>
<id>snapshots</id>
<url>https://nexus.codehaus.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>snapshots</id>
<url>https://nexus.codehaus.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
i've taken it from some online tutorial for building hibernate-gwt-maven project
It proably means you do not have javascript-maven-plugin-2.0.0-alpha-1.jar and aether-util-1.11.jar in your local or global maven repos.
You can find available javascript-maven-plugin and aether-util version at central repo here. Try downloading and installing them to your local m2 repo.
Note - They seem to be optional and I believe you can ditch the extension tag entirely from build tag. They might only help in compressing/cleaning up jquery js files ( ignore them for now )
I have problem importing a maven project which was created by Netbeans into the IDEA 12. The dependency artifacts writen in the pom doesn't work. It told me that "cannot resolve symbol 'springframework'" on "import org.springframework.xxx;". When I runs it, it says that org.springframework.xxx doesn't exist.
Here is the pom file
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.edu.seu.cose.jellyjolly</groupId>
<artifactId>jellyjolly-openshift-dist</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>Jelly Jolly Openshift Distribution</name>
<organization>
<name>College of Software Engineering, Southeast University</name>
<url>http://cose.seu.edu.cn/</url>
</organization>
<repositories>
<repository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<netbeans.hint.license>gpl30</netbeans.hint.license>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.0.Final-redhat-1</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.3.RELEASE</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet.ext.xml</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.java.dev.rome</groupId>
<artifactId>rome</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.3.RELEASE</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'webapps'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>jellyjolly</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
When the pom.xml file is available in your project, you can generate the files needed by IntelliJ idea project by running this command:
mvn idea:idea
Check out more options and details here:
http://maven.apache.org/plugins/maven-idea-plugin/usage.html
If the project runs on the command line (mvn clean install) the chance is like 100% it will work in IntelliJ 12 too :-)
After File -> Project Import -> From external Maven Model you should see the modules.
What I would check in the IntelliJ settings is the location of the maven home directory (File -> Settings -> Maven) and the settings.xml files it reads (or does not read).
The mvn install within the IDE should not differ from what happens on the command line. If it does it would compare mvn help:effective-settings output from the command line and from IntelliJ (maybe also from Netbeans).
If you just dont see all modules right click on the parent-pom.xml and choose maven -> reimport. To resolve the dependencies you have to execute an install once. It does not automatically resolve dependencies in all cases.
Had the same problem,
you can simply Right+Click on the code and go Maven->Reimport and it should do the trick
I used mvn -U idea:idea to generate the IntelliJ specific files with dependencies downloaded.