could the first ever maven build be made offline?

后端 未结 3 1374
情话喂你
情话喂你 2021-01-06 15:28

The problem: you have a zipped java project distribution, which depends on several libraries like spring-core, spring-context, jacskon, testng and slf4j. The task is to make

3条回答
  •  不要未来只要你来
    2021-01-06 15:47

    Maven has a '-o' switch which allows you to build offline:

     -o,--offline                           Work offline
    

    Of course, you will need to have your dependencies already cached into your $HOME/.m2/repository for this to build without errors. You can load the dependencies with:

    mvn dependency:go-offline
    

    I tried this process and it doesn't seem to fully work. I did a:

    rm -rf $HOME/.m2/repository
    mvn dependency:go-offline       # lot of stuff downloaded
    # unplugged my network
    # develop stuff
    mvn install                     # errors from missing plugins
    

    What did work however is:

    rm -rf $HOME/.m2/repository
    mvn install                     # while still online
    # unplugged my network
    # develop stuff
    mvn install
    

提交回复
热议问题