Maven missing artifact com.sun.jndi.ldap. What's wrong? - maven

How can I fix the missing artifact error in maven with the com.sun.jndi.ldap? I also tried to add the java repositories because of the strange binary licensing. This is my 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>ActiveDirectory</groupId>
<artifactId>my.activedirectory</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>my.activedirectory</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>java.net</id>
<url>http://download.java.net/maven/2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.java.dev.swing-layout</groupId>
<artifactId>swing-layout</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.jndi</groupId>
<artifactId>ldap</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
</project>
Can anybody help me with this issue?

I had the similar situation in looking up for Jndi jar using Maven.
Maven Central repo does not have this jar anymore.
You can download these jars from Oracle Archive #http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-plat-419418.html
and then install it into your local repository. This will solve the problem.
mvn install:install-file -DgroupId=javax.naming -DartifactId=jndi -Dversion=1.2.1 -Dpackaging=jar -Dfile=jndi-1_2_1.jar

Missing artifact exception occurs where the jar which you are looking for is not found in the repository where you have pointed to. I am afraid this jar or its latest version that you refer to is not available in the http://download.java.net/maven/2 repo.
Try jBoss repository or mavens central repo
<repository>
<id>jboss-maven2</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.com/maven2</url>
</repository>
or
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>

Related

error pom.xml error resolving version and error packaging

I found the error in my pom.xml. the error below:
Multiple annotations found at this line:
- Error resolving version for plugin 'org.apache.maven.plugins:maven-site-plugin' from the repositories
[local (C:\Users\c76266.m2\repository), release.fusesource.org
(http://repo.fusesource.com/nexus/content/repositories/releases),
ea.fusesource.org
(http://repo.fusesource.com/nexus/content/groups/ea), central
(https:// repo.maven.apache.org/maven2)]: Plugin not found in any
plugin repository
- Project build error: Unresolveable build extension: Plugin org.apache.felix:maven-bundle-plugin:2.3.7 or one of its dependencies
could not be resolved: The following artifacts could not be
resolved: org.apache.maven:maven-core:jar:2.0.7,
org.apache.maven:maven-settings:jar:2.0.7,
org.apache.maven:maven-plugin-parameter-documenter:jar:
2.0.7, org.apache.maven:maven-profile:jar:2.0.7, org.apache.maven:maven-model:jar:2.0.7,
org.apache.maven:maven-artifact:jar:2.0.7,
org.codehaus.plexus:plexus-container-
default:jar:1.0-alpha-9-stable-1,
org.apache.maven:maven-repository-metadata:jar:2.0.7,
org.apache.maven:maven-error-diagnostics:jar:2.0.7,
org.apache.maven:maven- project:jar:2.0.7,
org.apache.maven:maven-plugin-registry:jar:2.0.7,
org.apache.maven:maven-plugin-api:jar:2.0.7,
org.apache.maven:maven-plugin-descriptor:jar:2.0.7,
org.apache.maven:maven-artifact-manager:jar:2.0.7,
org.apache.maven:maven-monitor:jar:2.0.7,
classworlds:classworlds:jar:1.1: Could not transfer artifact
org.apache.maven:maven-core:jar:2.0.7 from/to central
(https://repo.maven.apache.org/maven2): unexpected end of stream on
Connection{repo.maven.apache.org:443, proxy=HTTP #
idnproxy.pru.intranet.asia/10.171.74.5:8080 hostAddress=10.171.74.5
cipherSuite=none protocol=http/1.1} (recycle count=0)
Project build error: Unknown packaging: bundle
How to fix this problem? thanks.
The Maven xml include seems to be fine code wise, so I'd say you have imported/installed something wrong, a different version maybe?
this is my 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>com.prudential.integration.middleware.common</groupId>
<artifactId>prudential-fuse-common-model</artifactId>
<version>1.0.1</version>
<packaging>bundle</packaging>
<name>Prudential Fuse Common Model</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>release.fusesource.org</id>
<name>FuseSource Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>ea.fusesource.org</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>release.fusesource.org</id>
<name>FuseSource Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>ea.fusesource.org</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.15.1.redhat-620133</version>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>3.0.4.redhat-620133</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
<version>2.15.1.redhat-620133</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

Jboss: How do I add Maven Dependencies required for JBoss AS 7 in a Spring Boot Application

I am trying to deploy my Spring Boot war file in JBoss AS (7.1.0. Final).
In the readme.txt inside JBoss, its mentioned as follows:
"Maven users should not use this jar, but should use the following BOM dependencies instead
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-jms-client-bom</artifactId>
<type>pom</type>
</dependency>
</dependencies>
This is because using maven with a shaded jar has a very high chance of causing class version conflicts, which is why we do not publish this jar to the maven repository."
I have tried giving the URL for all these dependencies, but not able to resolve them successfully.
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>
<!-- JBOSS AS 7 Maven Dependencies -->
<repositories>
<repository>
<id>jboss-enterprise-techpreview-group</id>
<name>JBoss Enterprise Technology Preview Maven Repository Group</name>
<url>http://maven.repository.redhat.com/techpreview/all/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
<groupId>com.demo</groupId>
<artifactId>SpringBoot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SpringBootDemo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- JBOSS AS 7 Maven Dependencies -->
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-jms-client-bom</artifactId>
<version>jboss-as-7.1.0.Final</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
While building the Spring Boot App using Maven, I get the following error:
[ERROR] Failed to execute goal on project SpringBoot: Could not
resolve dependencies for project
com.demo:SpringBoot:war:0.0.1-SNAPSHOT: Failed to collect dependencies
for
[org.springframework.boot:spring-boot-starter-actuator:jar:1.3.8.RELEASE
(compile),
org.springframework.boot:spring-boot-starter-web:jar:1.3.8.RELEASE
(compile),
org.springframework.boot:spring-boot-starter-test:jar:1.3.8.RELEASE
(test), com.teamcenter.HelloTeamcenter:HelloTeamcenter:jar:1.0
(compile),
org.jboss.as:jboss-as-jms-client-bom:pom:jboss-as-7.1.0.Final
(compile)]: Failed to read artifact descriptor for
org.jboss.as:jboss-as-jms-client-bom:pom:jboss-as-7.1.0.Final: Could
not transfer artifact
org.jboss.as:jboss-as-jms-client-bom:pom:jboss-as-7.1.0.Final from/to
jboss-enterprise-techpreview-group
(http://maven.repository.redhat.com/techpreview/all/): Access denied
to
http://maven.repository.redhat.com/techpreview/all/org/jboss/as/jboss-as-jms-client-bom/jboss-as-7.1.0.Final/jboss-as-jms-client-bom-jboss-as-7.1.0.Final.pom.
Error code 403, Proxy Unacknowledged -> [Help 1]
Please let me know what I am missing?
Thanks in Advance
UPDATE
I have given maven URL also, but no luck:
<repository>
<id>central</id>
<name>Maven Repository Group</name>
<url>https://repo1.maven.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
It seems that your proxy is blocking your connection due a lack of/wrong credentials. Check your settins.xml file to configure it properly.
Hope it helps.
I found the answer to my issue!
I added everything except the version:
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<version>7.1.0.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-jms-client-bom</artifactId>
<version>7.1.0.Final</version>
<type>pom</type>
</dependency>
I added the and it works!

Adding xuggler dependency gives error

I want to generate single thumbnail image from video so I'm using xuggler. I tried to add its dependency and repository.
<repository>
<id>xuggle repo</id>
<url>http://xuggle.googlecode.com/svn/trunk/repo/share/java/</url>
</repository>
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler</artifactId>
<version>5.2</version>
</dependency>
But after adding the dependency I get error
Missing artifact xuggle:xuggle-xuggler:jar:5.2.
According to this link I even changed the version but it still gives me error.
Please help. Thanks in advance
No one is maintaining Xuggler anymore, but there is still a saved repository.
Try using this repository for xuggler: https://files.liferay.com/mirrors/xuggle.googlecode.com/svn/trunk/repo/share/java/ (Version 5.4 ONLY)
Code:
<repositories>
<repository>
<id>xuggle repo</id>
<url>https://files.liferay.com/mirrors/xuggle.googlecode.com/svn/trunk/repo/share/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler</artifactId>
<version>5.4</version>
</dependency>
</dependencies>
On Maven Repository, we can read:
link: Xuggle maven repo
Note: this artifact it located at Dcm4Che repository
(http://www.dcm4che.org/maven2/)
Add this repository instead "files.liferay.com" repository
<repositories>
<repository>
<id>dcm4che repository</id>
<url>http://www.dcm4che.org/maven2/</url>
</repository>
</repositories>
EDIT: Alternative on Liferay's repository
Liferay's thirs party repo
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.xuggle.xuggler</artifactId>
<version>5.4</version>
<type>pom</type>
</dependency>
java 1.8
porn.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>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<groupId>groupId</groupId>
<artifactId>VideoInformation</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>xuggle repo</id>
<url>http://xuggle.googlecode.com/svn/trunk/repo/share/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler</artifactId>
<version>5.4</version>
</dependency>
</dependencies>
</project>
Xuggler main repo is not maintained but I maintain a fork since 7 years to add support to mobile (Android and iOS) and to be up to date with new versions of FFmpeg. You can use this artifact
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler-server-all</artifactId>
<version>5.7.0-SNAPSHOT</version>
</dependency>
You can configure the Maven repository with
<repositories>
<repository>
<id>olivier-ayache-xuggler</id>
<url>https://dl.cloudsmith.io/public/olivier-ayache/xuggler/maven/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>

Setting up a Maven Project that Utilizes Artifactory

Hello I am new to Maven and am trying to create a Maven project that:
Has dependencies that only Pull from Artifactory
Have artifacts only publish to Artifactory
Can change where artifacts are published (Integration or Dev)
Artifact published can be used as Dependencies
When published to Integration the maven pom file will be able to pass credentials, that is not accessible/viewable in the build output
Connection to artifactory not required to build/publish (Can publish locally)
Project can be built on the command line without eclipse on the machine
Currently this is the code I have for the Maven 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/xsd/maven-4.0.0.xsd">
<repositories>
<repository>
<id>central</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven Quick Start Archetype</name>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<dependencies>
<dependency>
<groupId>Test</groupId>
<artifactId>Test</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I'm more than certain this isn't set up correctly as this is my first time using Maven.
Edit: I have been reading from the Jfrog site that was suggested and while it has somewhat helped I am still not certain if what I have is correct by any means.
<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>
<!-- The Basics -->
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<packaging>...</packaging>
<dependencies>
<dependency>
<groupId>Test</groupId>
<artifactId>Test</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<parent>...</parent>
<dependencyManagement>...</dependencyManagement>
<modules>...</modules>
<properties>...</properties>
<!-- Build Settings -->
<build>...</build>
<reporting>...</reporting>
<!-- More Project Information -->
<name>Maven Quick Start Archetype</name>
<description>...</description>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<inceptionYear>...</inceptionYear>
<licenses>...</licenses>
<developers>...</developers>
<contributors>...</contributors>
<!-- Environment Settings -->
<issueManagement>...</issueManagement>
<ciManagement>...</ciManagement>
<mailingLists>...</mailingLists>
<scm>...</scm>
<prerequisites>...</prerequisites>
<repositories>
<repository>
<id>central</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>ArtifactoryDeploy</id>
<name>ArtifactoryDeployThing</name>
<url>http://artifactory/artifactory/webapp/home.html?2</url>
</distributionManagement>
<profiles>...</profiles>
</project>

Why can't I resolve the dependencies for GeoTools maven quickstart?

POM 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/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>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>
</project>
I get the error:
[ERROR] Failed to execute goal on project tutorial: Could not resolve dependencies for project org.geotools:tutorial:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.geotools:gt-shapefile:jar:10-SNAPSHOT, org.geotools:gt-swing:jar:10-SNAPSHOT: Could not find artifact org.geotools:gt-shapefile:jar:10-SNAPSHOT in maven2- repository.dev.java.net (http://download.java.net/maven/2) -> [Help 1]
Why can't it resolve the artifacts. GeoTools has other instructions (which I can't get to work) but I'd like to know whats wrong with this.
Thanks
The issue occurs because the org.geotools:gt-shapefile:jar:10-SNAPSHOT does not exist at either http://download.java.net/maven/2 or http://download.osgeo.org/webdav/geotools. All you have to do is define the snapshot repository for the GeoTools as it is mentioned at the GeoTools:Maven Quick Start as the following: -
<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>
I hope this may help.
Some of the repositories in above answers have been moved to alternative addresses. Adding the following repositories solved the issue for me.
<repository>
<id>osgeo-alt</id>
<url>https://repo.osgeo.org/repository/release/</url>
</repository>
<repository>
<id>geomajas</id>
<name>Geomajas Maven Repository</name>
<url>http://maven.geomajas.org/(http://maven.geomajas.org/)</url>
</repository>
Current available osgeo repo:
<repository>
<id>geotools</id>
<name>Geotools repository</name>
<!--<url>http://download.osgeo.org/webdav/geotools/</url>-->
<url>https://repo.osgeo.org/repository/geotools-releases/</url>
</repository>
http://download.java.net/maven/2 repository is gone
New updates, New way to add geotools dependency in your project, copy below xml file in your build.xml
<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>
It works
You should add Boundless repository and write https indtead of http:
<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>https://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>https://repo.boundlessgeo.com/main/</url>
</repository>
</repositories>
It will make the things work.

Resources