C++ Maven用户代理属性和pluginRepository 我想要什么

C++ Maven用户代理属性和pluginRepository 我想要什么,c++,maven,user-agent,C++,Maven,User Agent,让这本指南发挥作用 错误 我遇到HTTP 500错误代码的问题,如下所示: [ERROR] Unresolveable build extension: Plugin org.apache.maven.plugins:maven-nar-plugin:2.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plug

让这本指南发挥作用

错误 我遇到HTTP 500错误代码的问题,如下所示:

[ERROR]     Unresolveable build extension: Plugin org.apache.maven.plugins:maven-nar-plugin:2.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-nar-plugin:jar:2.1-SNAPSHOT (): Failed to read artifact descriptor for org.apache.maven.plugins:maven-nar-plugin:jar:2.1-SNAPSHOT: Could not transfer artifact org.apache.maven.plugins:maven-nar-plugin:pom:2.1-SNAPSHOT from/to Duns maven snapshot (http://duns.github.com/maven-snapshots/): Failed to transfer file: http://duns.github.com/maven-snapshots/org/apache/maven/plugins/maven-nar-plugin/2.1-SNAPSHOT/maven-nar-plugin-2.1-SNAPSHOT.pom. Return code is: 500, ReasonPhrase:( The request was rejected by the HTTP filter. Contact your Forefront TMG administrator.  ). -> [Help 2]
我试过的 我从“maven 5分钟入门”教程开始。这并没有顺利进行,因为我遇到了一个500 HTTP错误,因为forefront是在我当前的网络上实现的。我通过在我的settings.xml中设置User-Agent-string属性来解决这个问题

<servers>
    <server>
        <id>central</id>
        <configuration>
          <httpHeaders>
            <property>
                <name>User-Agent</name>
                <value>Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; InfoPath.1; SV1; .NET CLR 3.8.36217; WOW64; en-US)</value>
            </property>
          </httpHeaders>
        </configuration>
    </server>
</servers>

中心的
用户代理
Mozilla/5.0(兼容;MSIE 8.0;Windows NT 6.0;Trident/4.0;InfoPath.1;SV1;.NET CLR 3.8.36217;WOW64;en-US)
这很有效,我能够让maven为java项目工作

我本以为这将是HTTP 500错误的结束,但每当我试图从一个新的pluginRepository中提取插件时,我仍然会收到这些错误

我遵循了顶部链接的指南,只有一个例外。我没有将pluginRepository放在父文件夹的pom.xml中,而是将其放在settings.xml文件中的概要文件中。我确实第一次尝试输入pom.xml,但后来又将其拔出,希望它能修复它

maven中是否有不尊重我指定的用户代理字符串的内容?为什么它适用于maven 5分钟教程而不适用于其他任何东西

任何帮助都将不胜感激。谢谢

找到了答案

事实证明,我必须为我希望maven使用自定义用户代理字符串的每个插件存储库创建另一个服务器条目,方法是在标记中以pluginRepository的ID为目标

现在,如果有某种方法将用户代理字符串应用于所有将来定义的pluginrepositories就好了

编辑:接下来,我无法在maven中找到将用户代理字符串应用于所有pluginrepository配置的方法。我提出了一个解决方案,将Squid作为代理,用自定义的代理替换传出http请求中的用户代理属性,并将maven配置为使用该代理。它工作得很好