Is there a way to make Maven download snapshot versions automatically?

前端 未结 7 934
灰色年华
灰色年华 2021-02-05 08:27

So I have a project that depends on a snapshot version of another project. The dependency is:


  org.oop
  

        
7条回答
  •  不要未来只要你来
    2021-02-05 09:04

    Let's clear up terminology a bit to make sure there is no misunderstanding.

    "Maven Central" (http://search.maven.org/) is a global site where you only find releases. Central doesn't accept snapshots so deploying there should give you an error.

    You probably mean your local/company wide maven proxy/cache. These can also be configured to reject snapshot versions. In case of Nexus, you can also define more complex rules. In my case, I had an issue there which gave no error during mvn deploy but I could see an error in the server's logs.

    Try to follow the data: Enable debug (mvn -X) to see where Maven uploads the data. Then check the server to see whether the artifacts were really uploaded. Check the server's logs for errors.

    Also note that snapshot dependencies are only refreshed once a day; so this won't work:

    PC #1: mvn install -> Error missing dependency PC #2: mvn deploy PC #1: mvn install -> Dependency is still missing because of "update once per day" policy

    Try mvn install -U to force Maven to refresh its cached metadata.

提交回复
热议问题