Maven的settings.xml中的代理

时间:2017-03-29 17:15:57

标签: proxy maven-3

来自this question我试图让我的设置正常工作,但测试仍然失败,因为他们无法连接到远程站点。我升级到Maven 3.3.9。

这是我想要工作的settings.xml

<settings>

  <proxies>
    <proxy>
      <id>httpProxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.local</host>
      <port>3128</port>
      <nonProxyHosts>localhost|*.local</nonProxyHosts>
    </proxy>
    <proxy>
      <id>httpsProxy</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>10.20.20.208</host>
      <port>3128</port>
      <nonProxyHosts>localhost|*.local</nonProxyHosts>
    </proxy>
  </proxies>
:

这是一小部分,已经不起作用了:

<settings>

  <proxies>
    <proxy>
      <protocol>https</protocol>
      <host>10.20.20.208</host>
      <port>3128</port>
    </proxy>
  </proxies>
:

我还尝试将IP地址放在那里。

我知道Maven选择了这个XML,因为Maven在调试消息中这么说,如果我打破它的语法,Maven会抱怨。

唯一真正有效的方法是将-Dhttps.proxyHost=proxy.local -Dhttps.proxyPort=3128传递给Maven。

我在XML中做错了什么?

2 个答案:

答案 0 :(得分:2)

阅读完检查答案后,我尝试将其全部工作,实际上只需要修复maven-failsafe-plugin的插件配置:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.8</version>
    <executions>
      <execution>
        <id>integration-test</id>
        <goals>
          <goal>integration-test</goal>
        </goals>
        <configuration>
          <!-- added -Dhttps.proxyHost and -Dhttps.proxyPort -->
          <argLine>-Xmx512m -XX:MaxPermSize=512m -Dhttps.proxyHost=proxy.local -Dhttps.proxyPort=3128</argLine>
          <includes>
            <include>**/*ITest.java</include>
          </includes>
        </configuration>
      </execution>
      <execution>
        <id>verify</id>
        <goals>
          <goal>verify</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

所以我把它留在这里以防万一有人偶然发现同样的误解......

答案 1 :(得分:0)

您的测试可能不会像Maven版本及其插件那样读取>>> data = np.load("model.expElogbeta.npy") >>> data.shape (20, 6481) # i have trained with 20 topics == no of rows >>> dict = corpora.Dictionary.load(dictf) >>> len(dict.keys()) 6481 #columns of the npy array is the words in my dict 和Maven的版本。

您可以通过添加Welcome to Cloud Shell! Type "help" to get started. natu_neeraj@ai-finance-162601:~$ AIDIR=~/src/ai-fiance-162601/apiai-finance-2017-03-30-23-43 natu_neeraj@ai-finance-162601:~$ git clone https://github.com/Neeraj-Natu/NLP_Finance.git $AIDIR Cloning into '/home/natu_neeraj/src/ai-fiance-162601/apiai-finance-2017-03-30-23-43'... remote: Counting objects: 847, done. remote: Compressing objects: 100% (742/742), done. remote: Total 847 (delta 95), reused 819 (delta 85), pack-reused 0 Receiving objects: 100% (847/847), 2.04 MiB | 0 bytes/s, done. Resolving deltas: 100% (95/95), done. natu_neeraj@ai-finance-162601:~$ cd $AIDIR natu_neeraj@ai-finance-162601:~/src/ai-fiance-162601/apiai-finance-2017-03- 30-23-43$ git checkout master Already on 'master' Your branch is up-to-date with 'origin/master'. natu_neeraj@ai-finance-162601:~/src/ai-fiance-162601/apiai-finance-2017-03- 30-23-43$ dev_appserver.py $PWD Traceback (most recent call last): File "/google/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 101, in <module> _run_file(__file__, globals()) File "/google/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file execfile(_PATHS.script_file(script_name), globals_) File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2 .py", line 1041, in <module> main() File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1037, in main dev_server.stop() File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 845, in stop metrics.GetMetricsLogger().Stop() File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/metrics.py", line 117, in Stop total_run_time = int((Now() - self._start_time).total_seconds()) TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType' 来仔细检查这一点,并查看当surefire正在运行时会向测试发送哪些属性。