我想要的
要使本指南适用于http://blog.bigpixel.ro/2012/07/building-cc-applications-with-maven/
错误
我遇到了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分钟内入门”教程开始。这并不顺利,因为我遇到了一个500HTTP错误,因为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>这起作用了,我能够让maven为java项目工作。
我本以为这将是HTTP500错误的结束,但每当我尝试从新的pluginRepository中拉出插件时,我仍然会得到这些错误。
我遵循了顶部链接的指南,但有一个例外。我没有将pluginRepository放入父文件夹的pom.xml中,而是将其放入了我的settings.xml文件中的配置文件中。我一开始确实试着把pom.xml放进去,但后来把它拔出来,希望它能修好它。
maven中有没有什么东西没有遵守我指定的这个User-Agent字符串?为什么它只适用于maven 5分钟教程,而不适用于其他任何东西?
任何帮助都将不胜感激。谢谢!
发布于 2012-09-04 11:24:47
我想通了。
结果,我不得不为每个插件存储库创建另一个服务器条目,我希望maven通过在标记中获取pluginRepository的ID来使用自定义的用户代理字符串。
现在,如果有某种方法可以将用户代理字符串应用于所有将来定义的插件存储库就好了
编辑:随后,我在maven中找不到一种方法来将用户代理字符串应用到所有插件存储库配置中。我想出了一个变通方法,将Squid作为代理,将传出的http请求中的User-Agent属性替换为自定义的User-Agent属性,并将maven配置为使用该代理。它工作得很完美。
https://stackoverflow.com/questions/12256247
复制相似问题