{"action":"created","issue":{"url":"https://api.github.com/repos/sbt/sbt/issues/892","labels_url":"https://api.github.com/repos/sbt/sbt/issues/892/labels{/name}","comments_url":"https://api.github.com/repos/sbt/sbt/issues/892/comments","events_url":"https://api.github.com/repos/sbt/sbt/issues/892/events","html_url":"https://github.com/sbt/sbt/issues/892","id":20221561,"number":892,"title":"SBT reload fails on SNAPSHOT which are republished locally *while SBT runs*","user":{"login":"Blaisorblade","id":289960,"avatar_url":"https://avatars.githubusercontent.com/u/289960?v=3","gravatar_id":"","url":"https://api.github.com/users/Blaisorblade","html_url":"https://github.com/Blaisorblade","followers_url":"https://api.github.com/users/Blaisorblade/followers","following_url":"https://api.github.com/users/Blaisorblade/following{/other_user}","gists_url":"https://api.github.com/users/Blaisorblade/gists{/gist_id}","starred_url":"https://api.github.com/users/Blaisorblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blaisorblade/subscriptions","organizations_url":"https://api.github.com/users/Blaisorblade/orgs","repos_url":"https://api.github.com/users/Blaisorblade/repos","events_url":"https://api.github.com/users/Blaisorblade/events{/privacy}","received_events_url":"https://api.github.com/users/Blaisorblade/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sbt/sbt/labels/Invalid","name":"Invalid","color":"444444"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2013-09-29T00:18:39Z","updated_at":"2015-06-14T16:06:49Z","closed_at":"2013-09-30T14:47:13Z","body":"I'm developing a SBT plugin and testing it by reloading in a project using it. The reload however fails, complaining about corruption of the plugin JAR file, and I must exit and re-enter the client SBT project; this happened with SBT 0.13.0 in the client, and 0.12.4 in the SBT used for development.\r\n\r\nThe first time, the client SBT complained that it can't find `sbt/sbt.plugins` within the JAR. But unzip confirms the entry is there; exiting and re-entering SBT in the client project fixes the problem. The second time, the error was different, but again `unzip -t` confirms that the JAR is fine. The third time, the error was yet different, but again about ZIP corruption.\r\n\r\nNote that before the failed reload, lsof reveals that SBT has two file descriptors pointing at the JAR of the plugin, while afterwards it has three or four file descriptors. My suspect is that it does not reopen the JAR file from scratch, but tries to reuse some old info about it.\r\n\r\nTo support this hypothesis, this only happens if settings from the plugin are actually used (by putting `seq($thisPluginSettings: _*)` in build.sbt).\r\n\r\nSteps to reproduce in my case:\r\n```\r\ngit clone git@github.com:softprops/np.git\r\ncd np\r\n# edit build.sbt, set version to 0.2.1-SNAPSHOT\r\n# edit plugins/plugins.sbt, comment out gpg plugin\r\nsbt\r\n> publish-local\r\n# Close this or leave it open, we'll need it later.\r\n# Go to another project, even a fresh one\r\n# in project/plugins.sbt, add:\r\naddSbtPlugin(\"me.lessis\" % \"np\" % \"0.2.1-SNAPSHOT\")\r\n# in build.sbt, add:\r\nseq(npSettings: _*)\r\n# Start sbt\r\n# Go back to first console, reopen SBT or reuse the existing session (it doesn't matter), modify some source to force recompilation, perform publish-local\r\n# Go back to second console\r\n# Try using the plugin, it still works if used before, otherwise gives ClassNotFoundException.\r\n# Try a reload, get some error about corruption of the ZIP file, for instance:\r\n\r\n> reload\r\n[info] Loading global plugins from /Users/pgiarrusso/.sbt/0.13/plugins\r\n[info] Updating {file:/Users/pgiarrusso/.sbt/0.13/plugins/}global-plugins...\r\n[info] Resolving org.fusesource.jansi#jansi;1.4 ...\r\n[info] Done updating.\r\n[error] java.io.FileNotFoundException: JAR entry sbt/sbt.plugins not found in /Users/pgiarrusso/.ivy2/local/me.lessis/np/scala_2.10/sbt_0.13/0.2.1-SNAPSHOT/jars/np.jar\r\n[error] Use 'last' for the full log.\r\nProject loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?\r\n# Press i to ignore\r\n# Try using the plugin, get ClassNotFoundException:\r\n> np::scout\r\n[error] java.lang.NoClassDefFoundError: np/Plugin$$anonfun$npSettings0$2$$anonfun$apply$2$$anonfun$apply$3\r\n[error] Use 'last' for the full log.\r\n```\r\n\r\nError message 1:\r\n\r\n```\r\njava.io.FileNotFoundException: JAR entry sbt/sbt.plugins not found in /Users/pgiarrusso/.ivy2/local/me.lessis/np/scala_2.10/sbt_0.13/0.2.1-SNAPSHOT/jars/np.jar\r\n\tat sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:140)\r\n\tat sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150)\r\n\tat java.net.URL.openStream(URL.java:1037)\r\n\tat sbt.Using$$anonfun$urlReader$1.apply(Using.scala:87)\r\n\tat sbt.Using$$anonfun$urlReader$1.apply(Using.scala:87)\r\n\tat sbt.Using$$anon$3.open(Using.scala:65)\r\n\tat sbt.Using.apply(Using.scala:24)\r\n\tat sbt.IO$.readLinesURL(IO.scala:669)\r\n\tat sbt.Load$$anonfun$binaryPlugins$2.apply(Load.scala:630)\r\n\tat sbt.Load$$anonfun$binaryPlugins$2.apply(Load.scala:629)\r\n\tat scala.collection.immutable.Stream$$anonfun$flatMap$1.apply(Stream.scala:450)\r\n\tat scala.collection.immutable.Stream$$anonfun$flatMap$1.apply(Stream.scala:450)\r\n\tat scala.collection.immutable.Stream.append(Stream.scala:237)\r\n\tat scala.collection.immutable.Stream$$anonfun$append$1.apply(Stream.scala:237)\r\n\tat scala.collection.immutable.Stream$$anonfun$append$1.apply(Stream.scala:237)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$$plus$plus$1.apply(Stream.scala:330)\r\n\tat scala.collection.immutable.Stream$$anonfun$$plus$plus$1.apply(Stream.scala:330)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$scala$collection$immutable$Stream$$loop$4$1.apply(Stream.scala:850)\r\n\tat scala.collection.immutable.Stream$$anonfun$scala$collection$immutable$Stream$$loop$4$1.apply(Stream.scala:850)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream.force(Stream.scala:249)\r\n\tat scala.collection.immutable.Stream.mkString(Stream.scala:702)\r\n\tat sbt.BuildUtil$.importAll(BuildUtil.scala:65)\r\n\tat sbt.BuildUtil$.importAllRoot(BuildUtil.scala:66)\r\n\tat sbt.Load$.buildGlobalSettings(Load.scala:80)\r\n\tat sbt.Load$.loadGlobalSettings(Load.scala:74)\r\n\tat sbt.Load$.defaultWithGlobal(Load.scala:68)\r\n\tat sbt.Load$.defaultLoad(Load.scala:38)\r\n\tat sbt.BuiltinCommands$.doLoadProject(Main.scala:434)\r\n\tat sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:428)\r\n\tat sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:428)\r\n\tat sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)\r\n\tat sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)\r\n\tat sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)\r\n\tat sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)\r\n\tat sbt.Command$.process(Command.scala:95)\r\n\tat sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)\r\n\tat sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)\r\n\tat sbt.State$$anon$1.process(State.scala:176)\r\n\tat sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)\r\n\tat sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)\r\n\tat sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)\r\n\tat sbt.MainLoop$.next(MainLoop.scala:87)\r\n\tat sbt.MainLoop$.run(MainLoop.scala:80)\r\n\tat sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:69)\r\n\tat sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)\r\n\tat sbt.Using.apply(Using.scala:25)\r\n\tat sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)\r\n\tat sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)\r\n\tat sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)\r\n\tat sbt.MainLoop$.runLogged(MainLoop.scala:25)\r\n\tat sbt.xMain.run(Main.scala:26)\r\n\tat xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)\r\n\tat xsbt.boot.Launch$.withContextLoader(Launch.scala:77)\r\n\tat xsbt.boot.Launch$.run(Launch.scala:57)\r\n\tat xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)\r\n\tat xsbt.boot.Launch$.launch(Launch.scala:65)\r\n\tat xsbt.boot.Launch$.apply(Launch.scala:16)\r\n\tat xsbt.boot.Boot$.runImpl(Boot.scala:32)\r\n\tat xsbt.boot.Boot$.main(Boot.scala:21)\r\n\tat xsbt.boot.Boot.main(Boot.scala)\r\n[error] java.io.FileNotFoundException: JAR entry sbt/sbt.plugins not found in /Users/pgiarrusso/.ivy2/local/me.lessis/np/scala_2.10/sbt_0.13/0.2.1-SNAPSHOT/jars/np.jar\r\n[error] Use 'last' for the full log.\r\n```\r\n\r\nError message 2:\r\n```\r\njava.util.zip.ZipException: invalid stored block lengths\r\n\tat java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)\r\n\tat java.io.FilterInputStream.read(FilterInputStream.java:133)\r\n\tat sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)\r\n\tat sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)\r\n\tat sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)\r\n\tat java.io.InputStreamReader.read(InputStreamReader.java:184)\r\n\tat java.io.BufferedReader.fill(BufferedReader.java:154)\r\n\tat java.io.BufferedReader.readLine(BufferedReader.java:317)\r\n\tat java.io.BufferedReader.readLine(BufferedReader.java:382)\r\n\tat sbt.IO$.readLine$1(IO.scala:689)\r\n\tat sbt.IO$.foldLines(IO.scala:692)\r\n\tat sbt.IO$.readLines(IO.scala:677)\r\n\tat sbt.IO$$anonfun$readLinesURL$1.apply(IO.scala:669)\r\n\tat sbt.IO$$anonfun$readLinesURL$1.apply(IO.scala:669)\r\n\tat sbt.Using.apply(Using.scala:25)\r\n\tat sbt.IO$.readLinesURL(IO.scala:669)\r\n\tat sbt.Load$$anonfun$binaryPlugins$2.apply(Load.scala:630)\r\n\tat sbt.Load$$anonfun$binaryPlugins$2.apply(Load.scala:629)\r\n\tat scala.collection.immutable.Stream$$anonfun$flatMap$1.apply(Stream.scala:450)\r\n\tat scala.collection.immutable.Stream$$anonfun$flatMap$1.apply(Stream.scala:450)\r\n\tat scala.collection.immutable.Stream.append(Stream.scala:237)\r\n\tat scala.collection.immutable.Stream$$anonfun$append$1.apply(Stream.scala:237)\r\n\tat scala.collection.immutable.Stream$$anonfun$append$1.apply(Stream.scala:237)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$$plus$plus$1.apply(Stream.scala:330)\r\n\tat scala.collection.immutable.Stream$$anonfun$$plus$plus$1.apply(Stream.scala:330)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$scala$collection$immutable$Stream$$loop$4$1.apply(Stream.scala:850)\r\n\tat scala.collection.immutable.Stream$$anonfun$scala$collection$immutable$Stream$$loop$4$1.apply(Stream.scala:850)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:376)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1085)\r\n\tat scala.collection.immutable.Stream$Cons.tail(Stream.scala:1077)\r\n\tat scala.collection.immutable.Stream.force(Stream.scala:249)\r\n\tat scala.collection.immutable.Stream.mkString(Stream.scala:702)\r\n\tat sbt.BuildUtil$.importAll(BuildUtil.scala:65)\r\n\tat sbt.BuildUtil$.importAllRoot(BuildUtil.scala:66)\r\n\tat sbt.Load$.buildGlobalSettings(Load.scala:80)\r\n\tat sbt.Load$.loadGlobalSettings(Load.scala:74)\r\n\tat sbt.Load$.defaultWithGlobal(Load.scala:68)\r\n\tat sbt.Load$.defaultLoad(Load.scala:38)\r\n\tat sbt.BuiltinCommands$.doLoadProject(Main.scala:434)\r\n\tat sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:428)\r\n\tat sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:428)\r\n\tat sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)\r\n\tat sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)\r\n\tat sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)\r\n\tat sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)\r\n\tat sbt.Command$.process(Command.scala:95)\r\n\tat sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)\r\n\tat sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)\r\n\tat sbt.State$$anon$1.process(State.scala:176)\r\n\tat sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)\r\n\tat sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)\r\n\tat sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)\r\n\tat sbt.MainLoop$.next(MainLoop.scala:87)\r\n\tat sbt.MainLoop$.run(MainLoop.scala:80)\r\n\tat sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:69)\r\n\tat sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)\r\n\tat sbt.Using.apply(Using.scala:25)\r\n\tat sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)\r\n\tat sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)\r\n\tat sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)\r\n\tat sbt.MainLoop$.runLogged(MainLoop.scala:25)\r\n\tat sbt.xMain.run(Main.scala:26)\r\n\tat xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)\r\n\tat xsbt.boot.Launch$.withContextLoader(Launch.scala:77)\r\n\tat xsbt.boot.Launch$.run(Launch.scala:57)\r\n\tat xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)\r\n\tat xsbt.boot.Launch$.launch(Launch.scala:65)\r\n\tat xsbt.boot.Launch$.apply(Launch.scala:16)\r\n\tat xsbt.boot.Boot$.runImpl(Boot.scala:32)\r\n\tat xsbt.boot.Boot$.main(Boot.scala:21)\r\n\tat xsbt.boot.Boot.main(Boot.scala)\r\n```"},"comment":{"url":"https://api.github.com/repos/sbt/sbt/issues/comments/111843473","html_url":"https://github.com/sbt/sbt/issues/892#issuecomment-111843473","issue_url":"https://api.github.com/repos/sbt/sbt/issues/892","id":111843473,"user":{"login":"dwijnand","id":344610,"avatar_url":"https://avatars.githubusercontent.com/u/344610?v=3","gravatar_id":"","url":"https://api.github.com/users/dwijnand","html_url":"https://github.com/dwijnand","followers_url":"https://api.github.com/users/dwijnand/followers","following_url":"https://api.github.com/users/dwijnand/following{/other_user}","gists_url":"https://api.github.com/users/dwijnand/gists{/gist_id}","starred_url":"https://api.github.com/users/dwijnand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwijnand/subscriptions","organizations_url":"https://api.github.com/users/dwijnand/orgs","repos_url":"https://api.github.com/users/dwijnand/repos","events_url":"https://api.github.com/users/dwijnand/events{/privacy}","received_events_url":"https://api.github.com/users/dwijnand/received_events","type":"User","site_admin":false},"created_at":"2015-06-14T16:06:49Z","updated_at":"2015-06-14T16:06:49Z","body":"Ouch, this sucks :("}}