


How to solve the problem that maven cannot download dependent jar packages (example explanation)
The content of this article is about how to solve the virtual problem that Maven cannot download dependent jar packages (example explanation). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
The company has built a maven private server internally, and made a core jar package. The first version is xxx-core.1.0.0.SNAPSHOT, which can be used normally in both local and project environments. To support the launch, a stable version, xxx-core.1.0.0.jar, is released.
Local compilation is normal, startup is normal, project environment, when gitlab is automatically deployed to Rancher after submission, I find that the jar package cannot be downloaded.
Repository configuration of pom.xml file:
<repositories> <repository> <id>xxxxx.releases</id> <name>Releases</name> <url>https://nexus.xxxxxx.com/repository/maven-releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>xxxxxx.snapshots</id> <name>Snapshot</name> <url>https://nexus.huilianyi.com/repository/maven-snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository></repositories>
Maven error message when compiling:
Failed to execute goal on project service: Could not resolve dependencies for project com.xxxxx:service:war:1.0-SNAPSHOT: Failure to find com.xxxxx-core:jar:1.0.0 in https://nexus.xxxx.com/repository/maven-releases was cached in the local repository, resolution will not be reattempted until the update interval of xxx.releases has elapsed or updates are forced -> [Help 1]
The prompt is that the id of the repository configured in the private library: xxx.releases has a cache update interval. Before this update time, the jar is obtained from the cache, so it is newly uploaded to the warehouse xxx The jar package -core.1.0.0.jar is not in the cache
, so it is not pulled down.
Solution:
pom.xml changed to:
<repositories> <repository> <id>xxxxx.releases</id> <name>Releases</name> <url>https://nexus.xxxxxx.com/repository/maven-releases</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>xxxxxx.snapshots</id> <name>Snapshot</name> <url>https://nexus.huilianyi.com/repository/maven-snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository></repositories>
Note: After pulling it down, you need to remove this configuration, otherwise you will have to download the jar package every time, which is very time-consuming to compile.
The above is the detailed content of How to solve the problem that maven cannot download dependent jar packages (example explanation). For more information, please follow other related articles on the PHP Chinese website!

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Mac version
God-level code editing software (SublimeText3)