Home  >  Article  >  Java  >  How to solve the problem that maven cannot download dependent jar packages (example explanation)

How to solve the problem that maven cannot download dependent jar packages (example explanation)

不言
不言forward
2019-03-15 13:16:235817browse

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:


        
            xxxxx.releases
            Releases
            https://nexus.xxxxxx.com/repository/maven-releases
            
                true
            
            
                false
            
        
        
            xxxxxx.snapshots
            Snapshot
            https://nexus.huilianyi.com/repository/maven-snapshots
            
                false
            
            
                true
            
        

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:


        
            xxxxx.releases
            Releases
            https://nexus.xxxxxx.com/repository/maven-releases
            
                true
                always
            
            
                false
            
        
        
            xxxxxx.snapshots
            Snapshot
            https://nexus.huilianyi.com/repository/maven-snapshots
            
                false
            
            
                true
            
        

b99d2114378b6c85aa5339aed392eaf5The label is the update policy, always Always download the latest dependencies in the repository.
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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete