<dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.0.0.RELEASE</version> </dependency>
<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>test</groupId> <artifactId>dependency-testing</artifactId> <version>1.0.0</version> <name>Dependency test</name> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.0.0.RELEASE</version> </dependency> </dependencies> </project>
${user.home}/.m2/repository/
directory. <?xml version="1.0" encoding="UTF-8"?> <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <profiles> <profile> <repositories> <repository> <id>nexus-corp</id> <name>nexus-corp-repo</name> <url>http://nexus.mycompany.com:8081/nexus/central/</url> </repository> </repositories> <id>nexus</id> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
<mirror> <id>nexus-corp-mirror</id> <name>nexus-corp-mirror</name> <url>http://nexus.mirror.mycompany.com:8081/nexus/central/</url> <mirrorOf>nexus-corp</mirrorOf> </mirror>
<mirror> <id>all</id> <name>nexus-corp-mirror</name> <url>http://nexus.mirror.mycompany.com:8081/nexus/central/</url> <mirrorOf>*</mirrorOf> </mirror>
${maven.home}/conf/settings.xml
${user.home}/.m2/settings.xml
pom.xml
Global settings, the latter settings.xml. If both files exist, their contents will be dominant.In fact, if there were no conflicts during gluing, the repository priority is as follows, in decreasing order:
<?xml version="1.0" encoding="UTF-8"?> <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <profiles> <profile> <repositories> <repository> <id>repo-global-setting1</id> <url>http://nexus.mycompany.com:8081/nexus/repo-global-setting1-url/</url> </repository> </repositories> <id>g-nexus</id> </profile> </profiles> <activeProfiles> <activeProfile>g-nexus</activeProfile> </activeProfiles> </settings>
<?xml version="1.0" encoding="UTF-8"?> <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <profiles> <profile> <repositories> <repository> <id>repo-user-setting1</id> <url>http://nexus.mycompany.com:8081/nexus/repo-user-setting1-url/</url> </repository> <repository> <id>repo-user-setting2</id> <url>http://nexus.mycompany.com:8081/nexus/repo-user-setting2-url/</url> </repository> </repositories> <id>nexus</id> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
<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>test</groupId> <artifactId>dependency-testing</artifactId> <version>1.0.0</version> <name>Dependency test</name> <repositories> <repository> <id>repo-pom1</id> <url>http://nexus.mycompany.com:8081/nexus/repo-pom1-url/</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.25</version> </dependency> </dependencies> </project>
Could not resolve dependencies for project myproject:jar:1.0.0: Failed to collect dependencies at com.someproject:artifact-name:jar:1.0.0
?maven 3.5.0
jdk 1.8
debug maven
Source: https://habr.com/ru/post/339902/
All Articles