简体   繁体   中英

Maven cannot Download from local repository (nexus) for some dependency or plugins

I have a project (java) with some modules and I have local repository nexus. in pom.xml I set repository address:

 <repositories> <repository> <id>local-maven-repository</id> <url>http://nexus_repository:8080/repository/maven-public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>local-maven-repository2</id> <url>http://nexus_repository:8080/repository/maven-public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories>

But maven download from "repo.maven.apache.org" for some dependency or plugins. and for some dependency or plugins download from local repository.

according to https://blog.sonatype.com/using-nexus-3-as-your-repository-part-1-maven-artifacts I add setting.xml but I have error:

 <?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"> <servers> <server> <id>nexus-snapshots</id> <username>admin</username> <password>admin123</password> </server> <server> <id>nexus-releases</id> <username>admin</username> <password>admin123</password> </server> </servers> <mirrors> <mirror> <id>central</id> <name>central</name> <url>http://nexus_repository:8080/repository/maven-public/</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors> </settings>

 [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for org.glassfish.jersey:jersey-bom:2.30.1: Could not transfer artifact org.eclipse.ee4j:project:pom:1.0.5 from/to central (http://nexus_repository:8080/repository/maven-public/): nexus_repository: Name or service not known @ org.glassfish.jersey:jersey-bom:2.30.1, /root/.m2/repository/org/glassfish/jersey/jersey-bom/2.30.1/jersey-bom-2.30.1.pom, line 24, column 13 [ERROR] Non-resolvable import POM: Could not transfer artifact org.eclipse.jetty:jetty-bom:pom:9.4.31.v20200723 from/to central (http://nexus_repository:8080/repository/maven-public/): nexus.mohaymen.ir @ org.springframework.boot:spring-boot-dependencies:2.3.4.RELEASE, /root/.m2/repository/org/springframework/boot/spring-boot-dependencies/2.3.4.RELEASE/spring-boot-dependencies-2.3.4.RELEASE.pom, line 2944, column 19

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM