intellij-idea - 为什么 IntelliJ 中的 SBT 可以通过 Internet 访问 Maven,尽管我为它配置了本地 Nexus?

标签 intellij-idea sbt

我的 build.sbt 中有以下存储库

resolvers ++= Seq(
    "Maven Central" at "http://10.1.1.200:8080/nexus/content/repositories/central/",
    "Typesafe Repository" at "http://10.1.1.200:8080/nexus/content/repositories/typesafe/",
    "Atlassian Releases" at "http://10.1.1.200:8080/nexus/content/repositories/atlassian/",
    "scalaz-bintray" at "http://10.1.1.200:8080/nexus/content/repositories/scalaz-bintray/",
    "Sonatype Releases" at "http://10.1.1.200:8080/nexus/content/repositories/sonatype/"
  )

但是当我运行我的 Play 项目时,IntelliJ Idea 仍然通过 Internet 访问 Maven 存储库。当超时时,它似乎会到达本地存储库。

我如何配置它以首先访问本地 Nexus 存储库?

最佳答案

您应该如下更改 SBT 设置以使用自定义存储库

你需要

create a local file with name as "repositories" and with content in the below format (modify URL pattern to match yours)

[repositories]
local
my-ivy-proxy-releases: http://repo.company.com/ivy-releases/,[organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/artifact.[ext] my-maven-proxy-releases: http://repo.company.com/maven-releases/

然后,使用下面的配置

-Dsbt.override.build.repos=true -Dsbt.repository.config= .... rest of the parameters

按照以下进行更改

Go to settings (Ctrl + Alt + S) -> Other Settings -> SBT -> Add the above parameters to existing VM parameters

关于intellij-idea - 为什么 IntelliJ 中的 SBT 可以通过 Internet 访问 Maven,尽管我为它配置了本地 Nexus?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35942169/

相关文章:

java - 错误 :missing package statement 'src' but still can run the code in IntelliJ

java - 为什么 Canvas 窗口不显示?

scala - com.typesafe.sbt#sbt-pgp 发生了什么?

css - Scala Play 框架 : Duplicate mappings of compiled css files

intellij-idea - 如何在Intellij Idea中对齐三元表达式中的 '?'和 ':'?

intellij-idea - IntelliJ IDEA : Generate list of TODOs with Todo-text and according file

java - 如何忽略 IntelliJ 中的特定 TODO

scala - sbt 0.10下收集依赖(将所有依赖jar放到target/scala-version/lib/)

scala - 如何让 ScalaTest 在 xml 报告中填充测试运行时?

scala - 我可以在scala项目中使用docker-compose吗?