Maven 使用代理下載依賴

編輯~/.m2/settings.xml

$ vim ~/.m2/settings.xml

配置以下代理的協議,地址,端口

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <proxies>
                <proxy>
                        <id>my_proxy</id>
                        <active>true</active>
                        <protocol>https</protocol>
                        <username></username>
                        <password></password>
                        <host>192.168.14.1</host>
                        <port>1080</port>
                        <nonProxyHosts>localhost:127.0.0.1</nonProxyHosts>
                </proxy>
        </proxies>
</settings>

使用mvn命令時指定配置文件

$ mvn archetype:generate \
-DarchetypeRepository=https://repository.apache.org/content/groups/snapshots \
-DarchetypeGroupId=org.apache.beam \
-DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
-DarchetypeVersion=LATEST \
-DgroupId=org.example \
-DartifactId=word-count-beam \
-Dversion="0.1" \
-Dpackage=org.apache.beam.examples \
-DinteractiveMode=false \
-s ~/.m2/settings.xml
相關文章
相關標籤/搜索