unabel to resolve dependencies using maven - java

I am running maven 3.8.9 and this is what i have in pom.xml
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
This is what i have in settings.xml
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
I get Below error not sure what i am missing
Failed to collect dependencies at org.springframework.boot:spring-boot-starter-oauth2-client:jar:2.3.0.RC1
-> org.springframework.security:spring-security-oauth2-client:jar:5.3.1.RELEASE
-> com.nimbusds:oauth2-oidc-sdk:jar:7.1.1 -> com.nimbusds:nimbus-jose-jwt:jar:8.8
-> net.minidev:json-smart:jar:[1.3.1,2.3]: No versions available for net.minidev:json-smart:jar:[1.3.1,2.3] within specified range -> [Help 1]

If you are trying to pull a dependency (not a plugin), define an entry in repositories (not pluginRepositories). That easy.
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>http://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/plugins-snapshot</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/plugins-milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>http://repo.spring.io/plugins-release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>

Related

Why maven create folders on my project root?

im facing this problem and I dont know what to do. We import a project from git to Intellij, and when we execute mvn clean install, maven start creating all dependencies folders on our project root. This only happpends on one of our PCs, and we have no idea why:
Any idea about how to solve this?
Thanks!
Update with settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<localRepository />
<interactiveMode />
<usePluginRegistry />
<offline />
<pluginGroups />
<servers>
<server>
<username>xxxxxx</username>
<id>xxxxx</id>
<password>xxxxxx</password>
</server>
</servers>
<proxies>
<proxy>
<id>xxxx</id>
<active>true</active>
<protocol>http</protocol>
<host>xxxxx</host>
<port>8080</port>
<nonProxyHosts>10.36.|.xxxxx</nonProxyHosts>
</proxy>
</proxies>
<mirrors>
<mirror>
<id>xxx</id>
<mirrorOf>*</mirrorOf>
<name>xxxx</name>
<url>xxxxxxx</url>
</mirror>
<mirror>
<id>xxx</id>
<mirrorOf>*</mirrorOf>
<name>xxxxx</name>
<url>xxxxxx</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>artifactory</id>
<repositories>
<repository>
<id>central</id>
<name>libs-release</name>
<url>xxxxxx</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>xxxxxx</url>
<snapshots/>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>plugins-release</name>
<url>xxxxxx</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>xxxxxx</url>
<snapshots />
</pluginRepository>
<pluginRepository>
<id>central2</id>
<url>
https://repo1.maven.org/maven2/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>xxxx</id>
<repositories>
<repository>
<id>xxx</id>
<name>xxxx</name>
<url>xxxxxx</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>central2</id>
<url>
https://repo1.maven.org/maven2/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>xxxx</id>
<name>xxxxx</name>
<url>xxxxxxxx</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
<activeProfile>xxxx</activeProfile>
</activeProfiles>
</settings>
Intellij
This sounds like maven is configured to use the project root/the current directory as the location for the local repository.
Check settings.xml in ~/.m2, possibly rename it and try again.

Failure to find org.geoserver:gs-wms:jar:2.5.2

I have failed to build a maven web application because of one dependency gs-wms from geoserver.
Here is pom.xml
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-wms</artifactId>
<exclusions>
<exclusion>
<!-- xerces incompatible with JasperReports -->
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
Error returned is
Could not resolve dependencies for project my-app:web:jar:1.5.0: Failure to find org.geoserver:gs-wms:jar:2.5.2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
I tried to use mirror in settings.xml as follows
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<mirrors>
<mirror>
<mirrorOf>Maven repository</mirrorOf>
<id>mirror-for-geoserver-gs-wms</id>
<name>Repo for old geoserver version</name>
<url>https://mvnrepository.com/artifact/org.geoserver/gs-wms/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>mainProfile</id>
<repositories>
<repository>
<id>Maven repository</id>
<url>https://repo.maven.apache.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>repo-for-geoserver-gs-wms</id>
<url>https://mvnrepository.com/artifact/org.geoserver/gs-wms/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Maven repository</id>
<url>https://repo.maven.apache.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>repo-for-geoserver-gs-wms</id>
<url>https://mvnrepository.com/artifact/org.geoserver/gs-wms/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>mainProfile</activeProfile>
</activeProfiles>
</settings>
But I got the error
Could not resolve dependencies for project my-app:web:jar:1.5.0: Failure to find org.geoserver:gs-wms:jar:2.5.2 in https://mvnrepository.com/artifact/org.geoserver/gs-wms/ was cached in the local repository, resolution will not be reattempted until the update interval of mirror-for-geoserver-gs-wms has elapsed or updates are forced -> [Help 1]
Any advice will be appreciated.

Could not transfer artifact Transfer failed

I am getting below error for maven projects in intellij.
Could not transfer artifact org.apache.maven.plugins:maven-site-plugin:pom:3.3 from/to other-mirror (http://insecure.repo1.maven.org/maven2/): Transfer failed for http://insecure.repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom ProxyInfo{host='123.45.6.
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<type>maven-plugin</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
'''
This is my settings.xml
'''
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on https://repo1.maven.org/maven2</name>
<url>https://repo1.maven.org/maven2</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url> <!-- the https you've been looking for -->
<layout>default</layout>
<snapshots>
<enabled>false</enabled> <!-- or set to true if desired, default is false -->
</snapshots>
</repository>
</repositories>
<proxies/>
</settings>
'''
I tried to add proxy but no use. tried to add mirror as well but not working. Please let me know if you faced and fixed the same issue

Getting bunch of errors when try works with spring-boot

I am trying to work with spring boot but I am still getting damn errors.
I can't make it works so I can display jsps files.
[IMG]http://i63.tinypic.com/fkxnwk.jpg[/IMG]
[IMG]http://i66.tinypic.com/2hdw95v.jpg[/IMG]
package qq;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
#EnableAutoConfiguration
public class DeadApplication {
public static void main(String[] args) {
SpringApplication.run(DeadApplication.class, args);
}
#RequestMapping("/")
String home(){
return "home";
}
}
application.properties
spring.mvc.view.prefix=/WEB-INF/jsps/
spring.mvc.view.suffix=.jsp
debug=true
<?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>dead</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.9.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-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-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>

How to optimize mvn dependency download

Why does mvn wait for other calls when it is already done with the download
Based on the logs below, maven tries to download from other repositories though on line 5 it says "Downloaded". Looks like mvn did not find any updates on this resource, I guess that is why it reports "(0 B at 0.0 KB/sec)". I am not sure. Original subdomain is concealed here and shown as 'xyz' or 'abc', they are actually valid subdomains on intranet.
Downloading: http://xyz.qa.ebay.com/content/repositories/releases/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: http://xyz.qa.ebay.com/content/repositories/thirdparty/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: http://abc.qa.ebay.com/nexus/content/repositories/testinfrastructure.releases/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: http://xyz/content/repositories/central/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloaded: http://xyz/content/repositories/central/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom (0 B at 0.0 KB/sec)
Downloading: http://repo.spring.io/ext-release-local/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: http://repo.spring.io/milestone/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: http://repo.spring.io/snapshot/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: http://repository.springsource.com/maven/bundles/external/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Downloading: https://maven.java.net/content/repositories/releases/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk2-utils-2.4.0-b34.pom
Timeout configuration applied on <server> is not getting picked up. Stack overflow related issue.
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers>
<server>
<id>my-server</id>
<configuration>
<httpConfiguration>
<all>
<connectionTimeout>5000</connectionTimeout> <!-- milliseconds -->
<readTimeout>20000</readTimeout>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>central</id>
<mirrorOf>central</mirrorOf>
<url>http://xyzcentral/content/repositories/central</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>xyz</id>
<properties>
<archetypeCatalog>http://xyzcentral/content/repositories/releases/archetype-catalog.xml
</archetypeCatalog>
</properties>
<repositories>
<repository>
<id>framework.releases</id>
<url>http://xyzcentral.qa.xyz.com/content/repositories/releases/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>framework.snapshots</id>
<url>http://xyzcentral.qa.xyz.com/content/repositories/snapshots/
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>framework-thirdparty</id>
<url>http://xyzcentral.qa.xyz.com/content/repositories/thirdparty/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>repo1.releases</id>
<url>http://abccentral.qa.xyz.com/nexus/content/repositories/repo1.releases/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>repo1.snapshots</id>
<url>http://abccentral.qa.xyz.com/nexus/content/repositories/repo1.snapshots/
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<updatePolicy>daily</updatePolicy>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://xyzcentral/content/repositories/central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>framework-releases</id>
<url>http://xyzcentral/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>framework-plugins</id>
<url>http://xyzcentral/content/repositories/plugins</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>framework-snapshots</id>
<url>http://xyzcentral/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>framework-thirdparty</id>
<url>http://xyzcentral/content/repositories/thirdparty</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>xyz</activeProfile>
</activeProfiles>
</settings>

Categories