Maven offline - problem with mvn-plugins

前端 未结 6 1889
滥情空心
滥情空心 2021-01-12 06:49

I\'m using maven in my project and I need to run the build in a non-internet-access machine.

When I test my project build everything is working, bu

6条回答
  •  -上瘾入骨i
    2021-01-12 07:18

    I think this happens because Maven hasn't got the metadata available locally to determine if its plugin versions are correct. If you specify exact versions for your plugins (which is a good idea for reproducability anyway), it doesn't need to do the check, so will not try to connect to the remote repositories.

    By specify exact versions, I mean that in your project's POM you should add the version to the plugin declaration. For example:

    
      
        org.apache.maven.plugins
        maven-dependency-plugin
        
        2.0
      
    
    

    Note you can also force Maven to use internal repositories instead of Central by setting up repository mirrors. See this answer for more details on using repository managers and mirrors.

    In the config you included, you're setting your remote repository to point to your local repository, this is not a good idea. To run offline you should either pass -o at the command line or add this to your settings.xml:

    true
    

提交回复
热议问题