Nexus搭配Play的使用

Nexus配置

参考sbt官网文档,将ivy和maven库区分开,如图:

The most common mistake made when setting up a proxy repository for sbt is the attempting to merge both maven and ivy repositories into the same proxy repository. While some repository managers will allow this, it’s not recommended to do so.

Paste_Image.png

新增两个proxy仓库

Type Name Url
proxy ivy-releases http://repo.typesafe.com/typesafe/ivy-releases/
proxy sbt-plugin-releases http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/

新增一个group仓库

Type Name Members
group ivy-public ivy-releases, sbt-plugin-releases

加上Nexus自带的Maven库,我们有了两个group:

maven-public.png
ivy-public.png

Activator配置

Activator会在当前用户下产生~/.activator, ~/.sbt, ~/.ivy 3个目录。
在~/.sbt目录下新建repositories配置文件,添加如下内容:

[repositories]
  activator-launcher-local: file://${activator.local.repository-${activator.home-${user.home}/.activator}/repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  activator-local: file://${activator.local.repository-/Users/pandeng/Documents/_App/activator-dist-1.3.10/repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  my-ivy-proxy-releases: http://192.168.1.1:8081/repository/ivy-public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  my-maven-proxy-releases: http://192.168.1.1:8081/repository/maven-public/

看看效果

添加一个新的依赖:

libraryDependencies += "org.scala-tools" % "scala-stm_2.9.1" % "0.3"

使用activator命令试试,注意带上参数-Dsbt.override.build.repos=true。

$ activator compile -Dsbt.override.build.repos=true

可以看到依赖解析已经走到我们自己的Nexus库了:

[info] Resolving jline#jline;2.12.1 ...
[info] downloading http://192.168.1.1:8081/repository/maven-public/org/scala-tools/scala-stm_2.9.1/0.3/scala-stm_2.9.1-0.3.jar 
[info]  [SUCCESSFUL ] org.scala-tools#scala-stm_2.9.1;0.3!scala-stm_2.9.1.jar (1731ms)
[info] downloading http://192.168.1.1:8081/repository/maven-public/org/scalatest/scalatest_2.9.1/1.6.1/scalatest_2.9.1-1.6.1.jar ...
[info]  [SUCCESSFUL ] org.scalatest#scalatest_2.9.1;1.6.1!scalatest_2.9.1.jar (3603ms)
[info] Done updating.

回过头再看maven-central库,jar包已经缓存好了:

Paste_Image.png

待续

笔者通过在~/.activator/activatorconfig.txt配置文件中添加-Dsbt.override.build.repos=true的方式并没有生效,不知什么原因,有时间再试试···

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,364评论 19 139
  • 首先私服是一种衍生出来的特殊的Maven远程仓库,构建私服的好处请看3.5私服 可以帮助大家建立私服的仓库管理软件...
    zlcook阅读 10,795评论 0 32
  • 概述 作为Scala的标准构建工具,使用风格与Maven类似,由Scala语言写的,参考官方网站,目前的版本是0....
    墨弈阅读 13,445评论 0 52
  • 文章作者:Tyan博客:noahsnail.com 2.Introduction to the Spring Fr...
    SnailTyan阅读 5,524评论 7 56
  • 自祖母离世后,家里最显著的变化是坛子菜的味道变了。再没有那正宗的色香味儿了。一想到祖母,便思念起那又香又辣又好...
    小小佘阅读 639评论 2 4

友情链接更多精彩内容