Intellij and sbt 0.13.5 “URI has an authority component”

佐手、 提交于 2019-11-28 01:39:17

问题


I'm working on a play framework project using Java as well as Amazon Web Services. This is my build.sbt:

name := """RegistrationEndpoint"""

version := "1.0"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.5"

libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
//routesGenerator := InjectedRoutesGenerator

It runs with activator if I call "activator run" on the command line.

Intellij cannot build the project. It returns the following error message

java.lang.IllegalArgumentException: URI has an authority component
    at java.io.File.<init>(File.java:423)
    at sbt.Classpaths$.sbt$Classpaths$$bootRepository(Defaults.scala:1758)
    at sbt.Classpaths$$anonfun$appRepositories$1.apply(Defaults.scala:1729)
    at sbt.Classpaths$$anonfun$appRepositories$1.apply(Defaults.scala:1729)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at sbt.Classpaths$.appRepositories(Defaults.scala:1729)
    at sbt.Classpaths$$anonfun$41.apply(Defaults.scala:1102)
    at sbt.Classpaths$$anonfun$41.apply(Defaults.scala:1102)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.EvaluateSettings$MixedNode.evaluate0(INode.scala:175)
    at sbt.EvaluateSettings$INode.evaluate(INode.scala:135)
    at sbt.EvaluateSettings$$anonfun$sbt$EvaluateSettings$$submitEvaluate$1.apply$mcV$sp(INode.scala:69)
    at sbt.EvaluateSettings.sbt$EvaluateSettings$$run0(INode.scala:78)
    at sbt.EvaluateSettings$$anon$3.run(INode.scala:74)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
[error] java.lang.IllegalArgumentException: URI has an authority component

This same error results when I call sbt from anywhere (By calling "sbt" on the command line)

Any suggestions for where I should look? The error message does not include any locations in my actual playframework project.


回答1:


Activator somehow creates malformed repository URIs for Windows in C:/Users/User_Name/.sbt/repositories

Changing the activator repos to the below values (please note the three slashes after file:) fixed the issue for me.

[repositories]
  local
  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-//D:/.../activator-1.3.4/repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  maven-central
  ...

However every time you start activator UI or create a new project via activator later on the file is changed back again. So this is just a temporary workaround until it is fixed in activator.

You can subscribe to https://github.com/typesafehub/activator/issues/1033 to be notified when the bug is fixed.



来源:https://stackoverflow.com/questions/30710316/intellij-and-sbt-0-13-5-uri-has-an-authority-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!