加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – SBT dependsOn RootProject:不编译依赖项

发布时间:2020-12-16 18:39:37 所属栏目:安全 来源:网络整理
导读:我有一个非常简单的配置: //lazy val bananaRdfProject = RootProject( uri("git://github.com:stample/banana-rdf.git#"+bananaGitBranch) ) // lazy val bananaRdfProject = RootProject( uri("https://github.com/stample/banana-rdf.git#"+bananaGitBra
我有一个非常简单的配置:

//lazy val bananaRdfProject = RootProject( uri("git://github.com:stample/banana-rdf.git#"+bananaGitBranch) )
  // lazy val bananaRdfProject = RootProject( uri("https://github.com/stample/banana-rdf.git#"+bananaGitBranch) )
  // lazy val bananaRdfProject = ProjectRef( uri("https://github.com/stample/banana-rdf.git#"+bananaGitBranch),"banana-rdf")
  lazy val bananaRdfProject = RootProject( file("../banana-rdf") )


  lazy val main = play.Project(appName,appVersion,appDependencies).settings(...)
                     .dependsOn( bananaRdfProject )

我尝试使用上面4个不同的项目声明bananaRdfProject.

由于我可以在本地编辑这个banana-rdf,我希望每次构建我的play项目时都要重新编译它,这样我就不必发布banana-rdf …

但是当我尝试编译我的主要游戏项目时,它使用banana-rdf,它不编译banana-rdf,而是尝试编译主项目:编译失败,因为类路径中缺少banana-rdf类.

sebastien@clemence-XPS-L412Z:rww-play (master *%)$./play.old/play
[info] Loading project definition from /home/sebastien/Bureau/rww-play/project
[warn] there were 1 deprecation warning(s); re-run with -deprecation for details
[warn] one warning found
[info] Loading project definition from /home/sebastien/Bureau/banana-rdf/project
[info] Updating {file:/home/sebastien/Bureau/banana-rdf/project/}banana-rdf-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 2 Scala sources to /home/sebastien/Bureau/banana-rdf/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 11 deprecation warning(s); re-run with -deprecation for details
[warn] there were 2 feature warning(s); re-run with -feature for details
[warn] two warnings found
[info] Set current project to RWWeb (in build file:/home/sebastien/Bureau/rww-play/)
       _
 _ __ | | __ _ _  _
| '_ | |/ _' | || |
|  __/|_|____|__ /
|_|            |__/

play 2.2-TLS built with Scala 2.10.3-RC3 (running Java 1.7.0_45),http://www.playframework.com

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[RWWeb] $compile
[info] Updating {file:/home/sebastien/Bureau/banana-rdf/}banana...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Updating {file:/home/sebastien/Bureau/rww-play/}RWWeb...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 53 Scala sources and 1 Java source to /home/sebastien/Bureau/rww-play/target/scala-2.10/classes...
[error] /home/sebastien/Bureau/rww-play/app/controllers/CORSProxy.scala:4: object banana is not a member of package org.w3
[error] import org.w3.banana.plantain.Plantain
[error]               ^
[error] /home/sebastien/Bureau/rww-play/app/controllers/CORSProxy.scala:7: not found: type Plantain
[error] object CORSProxy extends org.www.readwriteweb.play.CORSProxy[Plantain](webClient) 
.................

是不是应该在尝试编译我的主项目之前编译banana-rdf?如果没有,取决于外部RootProject有什么意义?

解决方法

RootProject(文件(“../ banana-rdf”))项目引用只引用了根项目,你真正需要的是对banana-rdf子项目的引用(在rdf子目录中).

可用的子项目在https://github.com/w3c/banana-rdf/blob/master/project/build.scala中定义.有几个:

[main]> projects
[info] In file:/Users/jacek/sandbox/stackoverflow/19832655/
[info]   * main
[info] In https://github.com/w3c/banana-rdf.git
[info]     banana
[info]     banana-jena
[info]     banana-rdf
[info]     banana-rdf-test-suite
[info]     banana-sesame
[info]     examples
[info]     experimental
[info]     ldp
[info]     patch

要引用banana-rdf,您应该使用以下ProjectRef指向构建配置中的右侧模块(子项目).注意ProjectRef以及子项目的名称 – banana-rdf.

lazy val bananaRdfProject =
  ProjectRef(uri("https://github.com/w3c/banana-rdf.git"),"banana-rdf")

使用ProjectRef,您应该能够解析banana-rdf子项目中定义的任何类型.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读