对JS库的模糊引用:jquery.js [英] Ambiguous reference to a JS library: jquery.js

查看:225
本文介绍了对JS库的模糊引用:jquery.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ScalaJS

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.9")

with(在包含jquery-ui dep之后):

with (after included jquery-ui dep):

libraryDependencies += "be.doeraene" %%% "scalajs-jquery" % "0.9.0",
jsDependencies += "org.webjars" % "jquery" % 2.2.3 / "jquery.js",
jsDependencies += "org.webjars.bower" % "jquery-ui" % "1.11.4" / "draggable.js"

使用fastOptJS编译时出错:

error on compile with fastOptJS:

[error] - Ambiguous reference to a JS library: jquery.js
[error]   Possible paths found on the classpath:
[error]   - META-INF/resources/webjars/jquery/2.2.3/jquery.js
[error]   - META-INF/resources/webjars/jquery/3.0.0-beta1/src/jquery.js
[error]   - META-INF/resources/webjars/jquery/3.0.0-beta1/dist/jquery.js

我尝试过使用此线程: 如何解决对JS库的歧义引用"?如何解决SBT项目中webjar和scala-js jar之间的JS依赖关系?

I've tried with this thread: How to resolve "Ambiguous reference to a JS library"? and this How to troubleshoot JS dependencies between webjars and scala-js jars in an SBT project?

但是那并没有帮助我(至今)

but that have not helped me (yet)

已更新:已定义所有部门的我的构建项目

object BuildProject extends Build {

lazy val myPluginProject = Project(id = "my-site", base = file(".")).

settings(   

 version      := "0.1",
 scalaVersion := Versions.scala,

 ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },

 libraryDependencies += "be.doeraene" %%% "scalajs-jquery" % "0.9.0" exclude("org.webjars","jquery"),
 libraryDependencies += "com.lihaoyi" %%% "upickle" % Versions.upickle,

 libraryDependencies += "com.lihaoyi" %%% "scalatags" % Versions.scalaTags,

 // we will not use use DOM directly so commenting it
 libraryDependencies += "org.scala-js" %%% "scalajs-dom" % Versions.dom,


 jsDependencies += "org.webjars" % "jquery" % Versions.jquery / "jquery.js",

 jsDependencies += "org.webjars.bower" % "jquery-ui" % Versions.jqueryUI / "draggable.js",

  jsDependencies += "org.webjars.bower" % "webcomponents.js" % Versions.webcomponents / "webcomponents-lite.js",

 skip in packageJSDependencies := false,

 jsDependencies += RuntimeDOM,

 scalaJSUseRhino in Global := false ) .enablePlugins(ScalaJSPlugin)}

其中

  val dom = "0.9.0"
  val upickle = "0.4.0"
  val jquery = "2.2.3"
  val jqueryUI = "1.11.4"
  val webcomponents = "0.7.21"

更新2 -"2.2.3/jquery.js" + dependON

UPDATE 2 - "2.2.3/jquery.js" + dependsON

  jsDependencies += "org.webjars" % "jquery" % Versions.jquery / "2.2.3/jquery.js",

 jsDependencies += "org.webjars.bower" % "jquery-ui" % Versions.jqueryUI / "core.js" dependsOn "META-INF/resources/webjars/jquery/2.2.3/jquery.js",

然后:

[error]   Possible paths found on the classpath:
[error]   - META-INF/resources/webjars/jquery-ui/1.11.4/ui/core.js
[error]   - META-INF/resources/webjars/jquery/3.0.0-beta1/src/core.js

更新3 -"1.11.4/core.js" 如果:

UPDATE 3 - "1.11.4/core.js" If:

   jsDependencies += "org.webjars.bower" % "jquery-ui" % Versions.jqueryUI / "1.11.4/core.js" dependsOn "META-INF/resources/webjars/jquery/2.2.3/jquery.js",

然后:

[error] (compile:resolvedJSDependencies) org.scalajs.core.tools.jsdep.JSLibResolveException: Some references to JS libraries could not be resolved: [error] - Missing JS library:
1.11.4/core.js

更新:

从网络jar pom.xml中

from the web-jar pom.xml,

<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>1.11.1</version>
</dependency>
</dependencies>

我看不到它将取决于jquery 2.2.3 ...

I do not see that it would depend on jquery 2.2.3 ...

-

作为用户,我想要等几年才能成熟.

as a user, i guess will wait couple of years to make it mature.

推荐答案

您的依赖项

jsDependencies += "org.webjars" % "jquery" % 2.2.3 / "jquery.js"

含糊不清,因为您的类路径中有多个文件与后缀jquery.js相匹配.您可以使用更长的后缀来消除歧义,例如:

is ambiguous, because there are several files matching the suffix jquery.js on your classpath. You can use a longer suffix to disambiguate them, for example:

jsDependencies += "org.webjars" % "jquery" % 2.2.3 / "2.2.3/jquery.js"

仅与路径匹配

META-INF/resources/webjars/jquery/2.2.3/jquery.js

这篇关于对JS库的模糊引用:jquery.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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