sbt 0.13.8 URI has an authority component

12,292

Solution 1

The URI that activator adds to sbt repository list is lacking a third slash.

Open C:\Users\[USER]\.sbt\repositories

Add a third slash (i.e. activator-launcher-local: file:///${activator.local.repository-${activator.home-${user.home}/.activator}/repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/artifact.[ext])

Solution 2

I just removed the .sbt folder in C:\Users[USER]\ and the play project was imported successfully into intellij.

Solution 3

The solution is a bit trickier (you need to re-insert the slash every time). See here: https://github.com/typesafehub/activator/issues/1037

Solution 4

This is still an issue with Windows and the fix is to replace file:// with file:/// and doing so is super annoying so a good workaround is to setup a simple ant build.xml in the project root.

<project name="someName" default="run" basedir=".">
    <description>
        Fix sbt repositories
    </description>
    <property name="sbtrepo" location="${user.home}/.sbt/repositories"/>
    <target name="fixsbt">
        <replace file="${sbtrepo}" token="file://$" value="file:///$"/>
    </target>
    <target name="run" depends="fixsbt">
        <exec executable="C:\dev\Git\git-bash.exe" spawn="true">
            <arg line="-c 'activator run'" />
        </exec>
    </target>
</project>

You can either run the fixsbt target alone to do the file replace, or use the run target to fix the repositories file and then run activator. This example uses gitbash shell to run the command so you'll need to change the shell/path for your environment.

Share:
12,292

Related videos on Youtube

Carlos Hernandez Perez
Author by

Carlos Hernandez Perez

Updated on October 04, 2022

Comments

  • Carlos Hernandez Perez
    Carlos Hernandez Perez over 1 year

    I get this error when running sbt in a sbt project. I have JDK 8 and sbt 0.13.8. I can run activator command without a problem but I need sbt working because my IDE (IntelliJ IDEA) uses it to load the project.

    E:\work\workspace\knowlege\play-scala-di>sbt
        Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
        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:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        [error] java.lang.IllegalArgumentException: URI has an authority component
    
    • Mon Calamari
      Mon Calamari almost 9 years
      Would you share build.sbt, please?
    • taanielo
      taanielo almost 9 years
      I got rid of it when deleted ~/.sbt/ folder in your profile folder.
    • Chen OT
      Chen OT almost 9 years
      Thanks for your question! The Jason Touhey's answer helped me.
  • NewfrontSolutions
    NewfrontSolutions almost 9 years
    Thanks, there were two "file://" that I had to change to "file:///"
  • Elaqqad
    Elaqqad almost 9 years
    Hi I have the same problem and I think that it does not worth another question: how can I chnage that? I mean file:// to file:///
  • d33j
    d33j almost 9 years
    Was trying to get the 2.4.1 play framework up and running using the example java app. Activator was having similar issues and now works thanks to the additional slash.
  • Splaktar
    Splaktar almost 9 years
    If you don't have the ~/.sbt/repositories file, delete the ~/.sbt/ dir and run activator again. This should create it for you. Then adding the / does fix this issue.
  • kdazzle
    kdazzle almost 9 years
    wtf - how is that even an issue. Thanks!
  • Kristen
    Kristen almost 9 years
    Yes I have to do this every day, whats the solution for this?
  • Abhijith
    Abhijith over 8 years
    I don't have a file called repositories in my .sbt folder I am using activator 1.3.5
  • Vortex
    Vortex over 7 years
    saved hours of useless troubleshooting. posts like this are invaluable. i wonder how these issues come about.