Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbt 0.13.14 doesn't run on Windows #3086

Closed
eed3si9n opened this issue Apr 7, 2017 · 4 comments
Closed

sbt 0.13.14 doesn't run on Windows #3086

eed3si9n opened this issue Apr 7, 2017 · 4 comments
Assignees

Comments

@eed3si9n
Copy link
Member

eed3si9n commented Apr 7, 2017

If you came here by Googling "URI has an authority component", see #3088 for URL encoding of file path on Windows.


steps

run sbt 0.13.14 on Windows

problem

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
WARN: No sbt.version set in project/build.properties, base directory: C:\cygwin64\home\bgdev
[warn] Executing in batch mode.
[warn]   For better performance, hit [ENTER] to switch to interactive mode, or
[warn]   consider launching sbt without any commands, or explicitly passing 'shell'
java.lang.IllegalArgumentException: URI has an authority component
        at java.io.File.<init>(File.java:423)
        at sbt.Classpaths$.sbt$Classpaths$$bootRepository(Defaults.scala:1942)
        at sbt.Classpaths$$anonfun$appRepositories$1.apply(Defaults.scala:1912)
        at sbt.Classpaths$$anonfun$appRepositories$1.apply(Defaults.scala:1912)
        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:1912)
        at sbt.Classpaths$$anonfun$58.apply(Defaults.scala:1193)
        at sbt.Classpaths$$anonfun$58.apply(Defaults.scala:1190)
        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
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

expectation

notes

This is likely due to the way offline repo is specified.

@eed3si9n eed3si9n changed the title sbt 0.13.14 doesn't run on Windows sbt 0.13.14 doesn't run on Windows: URI has an authority component Apr 7, 2017
eed3si9n added a commit to eed3si9n/sbt that referenced this issue Apr 8, 2017
"authority component" in an URI is the first domain name part. On Mac the absolute file path starts with a / naturally, but on Windows user.home doesn't, so it requires an extra / in front to prevent "URI has an authority component" error.

Fixes sbt#3086
@eed3si9n eed3si9n self-assigned this Apr 8, 2017
eed3si9n added a commit to eed3si9n/sbt that referenced this issue Apr 8, 2017
Improve IO.toFile's for Windows, and use it for identifying resolvers.

Fixes sbt#3086
Fixes sbt#2150
eed3si9n added a commit to eed3si9n/sbt that referenced this issue Apr 8, 2017
Improve IO.toFile's handling for Windows, and use it for identifying resolvers.

This adds support to convert URL to File on Windows in several ways:

```
val u0 = new URL("file:C:\\Users\\foo/.sbt/preloaded")
val u1 = new URL("file:/C:\\Users\\foo/.sbt/preloaded")
val u2 = new URL("file://unc/Users/foo/.sbt/preloaded")
val u3 = new URL("file:///C:\\Users\\foo/.sbt/preloaded")
val u4 = new URL("file:////unc/Users/foo/.sbt/preloaded")
```

Note that `u0` and `u2` are something `new File(u.toURI)` won't handle. This also correctly handles UNC convention specified by Microsoft in https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/.

Fixes sbt#3086
Fixes sbt#2150
@eed3si9n eed3si9n changed the title sbt 0.13.14 doesn't run on Windows: URI has an authority component sbt 0.13.14 doesn't run on Windows Apr 8, 2017
eed3si9n added a commit to eed3si9n/sbt that referenced this issue Apr 9, 2017
sbt#3088 attemped to fix the sbt#3086, but by putting no slashes in `sbt.boot.properties` the launcher created by 0.13.15-* becomes incompatible for all previous sbt versions.

The uglier but backward compatible fix for sbt#3086 is to use u3 format with three slashes. This on Windows will resolve to `file:///C:/Users/foo/.sbt/preloaded`, and on Mac and Linux `file:////root/.sbt/preloaded/`. Mac and Linux are both tolerant of extra slashes on the front:

```
> eval new File(new URL("file:////Users/foo/.sbt/preloaded/").toURI)
[info] ans: java.io.File = /Users/foo/.sbt/preloaded
```
@dejan2609
Copy link

dejan2609 commented Apr 9, 2017

I just upgraded from sbt 0.13.12 to sbt 0.13.15: build works as expected (on Windows 10).
Thanx @eed3si9n !

@eed3si9n
Copy link
Member Author

eed3si9n commented Apr 9, 2017

The buggy part was the launcher so you have to test https://bintray.com/sbt/native-packages/download_file?file_path=sbt%2F0.13.15%2Fsbt-0.13.15.msi.

@dejan2609
Copy link

Tested, all green.

image

@eed3si9n
Copy link
Member Author

eed3si9n commented Apr 9, 2017

Thank you!

eed3si9n added a commit to eed3si9n/sbt that referenced this issue Apr 12, 2017
The uglier but backward compatible fix for sbt#3086 is to use u3 format with three slashes. This on Windows will resolve to `file:///C:/Users/foo/.sbt/preloaded`, and on Mac and Linux `file:////root/.sbt/preloaded/`. Mac and Linux are both tolerant of extra slashes on the front:

```
> eval new File(new URL("file:////Users/foo/.sbt/preloaded/").toURI)
[info] ans: java.io.File = /Users/foo/.sbt/preloaded
```
eed3si9n added a commit to eed3si9n/io that referenced this issue Apr 12, 2017
Improve IO.toFile's handling for Windows, and use it for identifying resolvers.

This adds support to convert URL to File on Windows in several ways:

```
val u0 = new URL("file:C:\\Users\\foo/.sbt/preloaded")
val u1 = new URL("file:/C:\\Users\\foo/.sbt/preloaded")
val u2 = new URL("file://unc/Users/foo/.sbt/preloaded")
val u3 = new URL("file:///C:\\Users\\foo/.sbt/preloaded")
val u4 = new URL("file:////unc/Users/foo/.sbt/preloaded")
```

Note that `u0` and `u2` are something `new File(u.toURI)` won't handle. This also correctly handles UNC convention specified by Microsoft in https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/.

Fixes sbt/sbt#3086
Fixes sbt/sbt#2150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants