通过SBT中的https访问Maven回购 [英] Access maven repo over https in sbt

查看:423
本文介绍了通过SBT中的https访问Maven回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用sbt(scala)进行构建的Java项目.直到昨天,它仍然有效,但是今天我看到了从Maven中提取回购协议的问题

I have a java project which uses sbt(scala) for build. Up until yesterday this was working, but today I am seeing an issue in pulling a repo from maven

esolving org.codehaus.plexus#plexus-component-api;1.0-alpha-16 ...

[error] SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom

[warn]  module not found: org.codehaus.plexus#plexus-component-api;1.0-alpha-16

[warn] ==== typesafe-ivy-releases: tried

[warn]   http://repo.typesafe.com/typesafe/ivy-releases/org.codehaus.plexus/plexus-component-api/1.0-alpha-16/ivys/ivy.xml

[warn] ==== sbt-plugin-releases: tried

[warn]   http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.codehaus.plexus/plexus-component-api/1.0-alpha-16/ivys/ivy.xml

[warn] ==== local: tried

[warn]   /root/.ivy2/local/org.codehaus.plexus/plexus-component-api/1.0-alpha-16/ivys/ivy.xml

[warn] ==== activator-local: tried

[warn]   file:/heimdall/app/projects/load-test/content-engine/repository/org.codehaus.plexus/plexus-component-api/1.0-alpha-16/ivys/ivy.xml

[warn] ==== public: tried

[warn]   http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom

[warn] ==== typesafe-releases: tried

[warn]   http://repo.typesafe.com/typesafe/releases/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom

[warn] ==== typesafe-ivy-releasez: tried

[warn]   http://repo.typesafe.com/typesafe/ivy-releases/org.codehaus.plexus/plexus-component-api/1.0-alpha-16/ivys/ivy.xml

[warn] ==== Typesafe repository: tried

[warn]   http://repo.typesafe.com/typesafe/releases/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom

根据我的推断,回购似乎已移至https端点. pom文件在https端点上可用.问题在于,这不是我项目中的直接依赖关系,而是通过其他依赖关系可传递的.如何将https用于此特定依赖项?

Based on what I could infer, the repo seems to have been moved to https endpoint. And pom file is available on https endpoint. The issue is that this is not a direct dependency in my project but coming transitively via some other dependency. How do I use https for this specific dependency?

我正在使用sbt版本0.13.5.我检查了参考手册,并添加了 DefaultMavenRepository 在build.sbt中明确显示

I am using sbt version 0.13.5. I checked the reference manual for it, and added DefaultMavenRepository explicitly in build.sbt

resolvers += DefaultMavenRepository

根据此官方文档,DefaultMavenRepository指向安全端点.在此之前,我曾在build.sbt

As per this official documentation, the DefaultMavenRepository points to secure endpoint. Before this, I had tried the following in build.sbt

resolvers += "Maven Repo" at  "https://repo1.maven.org/maven2/" 

并添加了

"org.codehaus.plexus" % "plexus-component-api" % "1.0-alpha-16", 

在我的build.sbt中显式地作为libraryDepdency,以便可以对其进行缓存,并且不能传递给我可能无法控制将其从何处拉出的位置.但这也失败了.我同时清除了m2和ivy2缓存

as libraryDepdency explicitly in my build.sbt so that it can be cached and not come transitively where I may not have control over where it would be pulled from. But this also fails. I cleared both m2 and ivy2 caches

推荐答案

如Sarvesh所述,问题是我使用的是sbt版本0.13.5.并且DefaultMavenRepository从v0.13.6开始指向https端点(文档中没有提到这一点).改进版本后,我可以拉出所有依赖项.

As mentioned by Sarvesh, the issue was that I was using sbt version 0.13.5. And DefaultMavenRepository started pointing to https endpoint from v0.13.6(the documentation does not mention this). After bumping up the version, I was able to pull all dependencies.

这篇关于通过SBT中的https访问Maven回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆