Sbt:无法解析的webjar依赖项 [英] Sbt: Unresolvable webjar dependencies

查看:168
本文介绍了Sbt:无法解析的webjar依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用angular-seed-play-java模板创建了新的play框架应用.因此,现在我正在尝试将Babel安装为编译器.

I've created new play framework app using a angular-seed-play-java template. So now I'm trying to install Babel as a transpiler.

按照这些说明,我已将sbt-babeljs添加到我的 plugins.sbt
https://github.com/stonexx/sbt-babeljs .

Following these instructions I've added sbt-babeljs to my plugins.sbt
https://github.com/stonexx/sbt-babeljs .

然后我要在本地安装bubel-core.我从 http://www.webjars.org/获取了一个webjar,并将以下行插入了我的 build.sbt .

Then I want to install bubel-core locally. I got a webjar from the http://www.webjars.org/ and inserted the following line into my build.sbt .

"org.webjars.npm" % "babel-core" % "6.11.4"

我遇到无法解决的依赖错误:

I'm getting unresolved dependency error:

[error] (*:update) sbt.ResolveException: unresolved dependency: org.webjars.npm#babel-types;[6.9.1,7): not found  
[error] unresolved dependency: org.webjars.npm#babel-template;[6.9.0,7): not found
[error] unresolved dependency: org.webjars.npm#babel-traverse;[6.11.4,7): not found

http://www.webjars.org/不需要babel类型的版本.我在其他一些webjar中也遇到了类似的问题.我经常遇到无法解决的依赖错误.我应该如何解决这些问题?

There is no required version of babel-types at http://www.webjars.org/ . And I get similar problems with some other webjars. I constantly get unresolved dependency errors. How I supposed to solve those?

提前谢谢.

推荐答案

希望您已检查解析器.

Hope that you have checked the SBTDependency Documentation for play framework in the official site. Check SBTDocumentation for Resolvers too.

在尝试以下所有我在网上找到的不同解决方案之前,我建议您先尝试此方法.

I would recommend you try this 1st before trying all below different solutions that I found online.

按照您提到的方式在本地下载 buble-core 并将其放置在本地.m2文件夹中,使其可以作为本地存储库使用.

Download the buble-core locally as you mentioned and place it in the local .m2 folder to make it available as a local repository.

通过sbt通过如下所示的解析器进行设置,让sbt知道下载的webjar的位置-如果将sbt添加为存储库,则sbt可以搜索您本地的Maven存储库:

Let sbt get to know the location of the downloaded webjar by setting it through resolvers like below - sbt can search your local Maven repository if you add it as a repository:

resolvers += (
    "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/repository"
)

希望这在您的情况下有效,如果不起作用,请尝试以下我在网上找到的解决方案

Hope this should work in your situation, if this didn't work try below solution I found online

Try1

  1. 通过npm全局安装babel-core:

npm安装babel-core -g

npm install babel-core -g

  1. 然后添加名为'NODE_PATH'的环境变量,其值为'%AppData%\ npm \ node_modules'
  1. Then add environment variable called 'NODE_PATH' with value '%AppData%\npm\node_modules'

Try2

在项目根目录中创建package.json文件,然后编写以下内容.

Create package.json file in project root and write the below.

{
  "devDependencies": {
    "babel-core": "^6.2.4"
  }
}

然后在sbt控制台上运行"babel"任务.

then Run "babel" task on sbt console.

Try3

创建 [node_modules] 目录并自动下载babel-core. (您不必全局安装[babel-core]并设置环境.)

Create [node_modules] directory and download babel-core automatically. (You don't have to [babel-core] install globally and set environment.)

所有这些Try-Solutions的来源是.

Source for all these Try-Solutions is this.

这篇关于Sbt:无法解析的webjar依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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