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

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!

Related

Spring Boot application fat jar fails with 'Unable to open root Jar file'

After compiling my Spring Boot application with mvn clean install I am not being able to run the fat jar with java -jar target/myapplication-1.0.jar due to the following error:
java.io.IOException: Unable to open root Jar file 'war:file:/Users/coterobarros/git/repository/myapplication/target/myapplication-1.0.jar*/BOOT-INF/lib/spring-webmvc-5.3.1.jar'
...
Unzipping the application fat jar, the allegedly missing spring-webmvc-5.3.1.jar jar file can be found at BOOT-INF/lib/spring-webmvc-5.3.1.jar.
On the other hand, the application can be successfully run from Spring Tool Suite 4 IDE or issuing mvn spring-boot:run.
Notice an asterisk * between the fat jar path and the path to spring-webmvc-5.3.1.jar. I suppose this is the error, but I don't know where this symbol comes from.
Any Idea?
This is my 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0-SNAPSHOT</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.ofaraday</groupId>
<artifactId>myapplication</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>myapplication</name>
<description>myapplication.com application</description>
<properties>
<java.version>14</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!-- To add custom properties to application.properties -->
<!-- See https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#configuration-metadata-annotation-processor -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

ERROR: Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom

I am getting the below exception in my pom.xml when trying to run my application. I saw some posts regarding the error and followed them but no use. I understand the artifact(parent) is referred locally and is not present, but I don't know how to resolve this, could somebody please help me?
The error is
Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT: Failure
to transfer org.springframework.boot:spring-boot-starter-parent:pom:1.5.18.BUILD-SNAPSHOT
from https://repo.spring.io/snapshot was cached in the local repository, resolution will not be
reattempted until the update interval of spring-snapshots has elapsed or updates are forced.
Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-
parent:pom:1.5.18.BUILD-SNAPSHOT from/to spring-snapshots (https://repo.spring.io/
snapshot): repo.spring.io and 'parent.relativePath' points at no local POM
below is the 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>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.18.BUILD-SNAPSHOT</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-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Downgrade the spring boot starter to lower version.
Update the Maven project.
Hope it works.
There is an issue with the version of Spring Boot you are using, as it is a build. Just copy another release version of 1.X and replace it.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.17.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
If you can access the url https://repo.spring.io/snapshot/ from your browser, then it can be a Maven issue. Maven is unable to connect to the repository and that can be due to:
Any cache issues in the downloaded dependencies. Try deleting the local dependencies, and try out the solution provided here.
Try Maven Update and Maven Clean.
Try re-opening the IDE after doing the above.
Your pom.xml is fine, it looks like it's a problem with your internet connection. Check if you can reach https://repo.spring.io/snapshot/ with your browser. If yes, check if you need to configure a proxy server. If no, you should contact your internet provider.
Here is the documentation on how you configure a proxy server for Maven:

Downloading dependencies from additional repository maven

I want to use new version of Spring Boot in my webapp (1.4.0 RC1), so I added additional repository to my pom.xml file:
<project>
<groupId>com.exampleRestApp</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RC1</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1102-jdbc41</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
And it works well with Idea, but when I'm trying to build the project with maven I'm getting this error:
Plugin org.springframework.boot:spring-boot-maven-plugin:1.4.0.RC1 or one of its dependencies could not be resolved: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:1.4.0.RC1 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
Maven uses separate repository configuration for plugins and for "normal" dependencies. This means that you also need to add a <pluginRepository> to access the 1.4.0.RC1 version of Boot's Maven plugin:
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
</pluginRepository>
</pluginRepositories>
Make the repository definition like:
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
use this repo
<repository>
<id>spring-milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</repository>

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>

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