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

Ivy import of cats library fails and corrupts Ivy Cache #473

Closed
zenaptix opened this Issue Sep 21, 2016 · 30 comments

Comments

Projects
None yet
@zenaptix
Copy link

zenaptix commented Sep 21, 2016

If I try and import the cats library (there might be others) I get the error below and afterwards my Ivy cache is corrupted and SBT fails when I run sbt update - specifically the scala and sbt libraries are corrupted and fails with
org.scala-lang#scala-library;2.11.8: configuration not found in org.scala-lang#scala-library;2.11.8: 'master(compile)'. Missing configuration: 'compile'.
If I delete scala and scala sbt libs from the ivy cache and they are downloaded again SBT works again.
I have tested this repeatedly and the behaviour is consistent. I am using ammonite repl 0.7.7.

import $ivy.org.typelevel::cats:0.7.2`, cats._

:: resolving dependencies :: org.typelevel#cats_2.11-caller;working
confs: [default]
found org.typelevel#cats_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats_2.11;0.7.2
found org.scala-lang#scala-library;2.11.8 in m2
found org.typelevel#cats-macros_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-macros_2.11;0.7.2
found com.github.mpilquist#simulacrum_2.11;0.8.0 in chain-resolver
found org.typelevel#macro-compat_2.11;1.1.1 in chain-resolver
found org.typelevel#machinist_2.11;0.4.1 in chain-resolver
found org.scala-lang#scala-reflect;2.11.7 in m2
found org.typelevel#cats-kernel_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-kernel_2.11;0.7.2
found org.typelevel#cats-kernel-laws_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-kernel-laws_2.11;0.7.2
found org.scalacheck#scalacheck_2.11;1.12.5 in chain-resolver
found org.scala-sbt#test-interface;1.0 in m2
found org.typelevel#discipline_2.11;0.4 in chain-resolver
found org.typelevel#catalysts-platform_2.11;0.0.2 in chain-resolver
[0.0.2] org.typelevel#catalysts-platform_2.11;0.0.2
found org.typelevel#catalysts-macros_2.11;0.0.2 in chain-resolver
[0.0.2] org.typelevel#catalysts-macros_2.11;0.0.2
found org.typelevel#cats-core_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-core_2.11;0.7.2
found org.typelevel#cats-laws_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-laws_2.11;0.7.2
found org.typelevel#cats-free_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-free_2.11;0.7.2
found org.typelevel#cats-jvm_2.11;0.7.2 in chain-resolver
[0.7.2] org.typelevel#cats-jvm_2.11;0.7.2
ammonite.runtime.tools.IvyThing$IvyResolutionException: failed to resolve ivy dependencies unresolved dependency: org.scala-lang#scala-library;2.11.8: configuration not found in org.scala-lang#scala-library;2.11.8: 'master(compile)'. Missing configuration: 'compile'. It was required from org.typelevel#cats-jvm_2.11;0.7.2 compile, unresolved dependency: org.scala-lang#scala-reflect;2.11.7: configuration not found in org.scala-lang#scala-reflect;2.11.7: 'master(compile)'. Missing configuration: 'compile'. It was required from org.typelevel#machinist_2.11;0.4.1 compile, unresolved dependency: org.scala-sbt#test-interface;1.0: configuration not found in org.scala-sbt#test-interface;1.0: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalacheck#scalacheck_2.11;1.12.5 compile
ammonite.runtime.tools.IvyThing.resolveArtifact(IvyThing.scala:108)
ammonite.runtime.Interpreter.loadIvy(Interpreter.scala:592)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$resolve$2.liftedTree1$1(ImportHook.scala:166)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$resolve$2.apply(ImportHook.scala:166)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$resolve$2.apply(ImportHook.scala:160)
ammonite.util.Res$Success.flatMap(Res.scala:57)
ammonite.runtime.ImportHook$BaseIvy.resolve(ImportHook.scala:160)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4$$anonfun$apply$3.apply(ImportHook.scala:175)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4$$anonfun$apply$3.apply(ImportHook.scala:175)
ammonite.util.Res$$anonfun$1.apply(Res.scala:33)
ammonite.util.Res$$anonfun$1.apply(Res.scala:30)
scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
scala.collection.immutable.List.foldLeft(List.scala:84)
ammonite.util.Res$.map(Res.scala:30)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4.apply(ImportHook.scala:175)
ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4.apply(ImportHook.scala:174)
ammonite.util.Res$Success.flatMap(Res.scala:57)
ammonite.runtime.ImportHook$BaseIvy.handle(ImportHook.scala:174)
ammonite.runtime.Interpreter$$anonfun$resolveSingleImportHook$3.apply(Interpreter.scala:151)
ammonite.runtime.Interpreter$$anonfun$resolveSingleImportHook$3.apply(Interpreter.scala:150)
ammonite.util.Res$Success.flatMap(Res.scala:57)
ammonite.runtime.Interpreter.resolveSingleImportHook(Interpreter.scala:150)
ammonite.runtime.Interpreter$$anonfun$resolveImportHooks$2.apply(Interpreter.scala:199)
ammonite.runtime.Interpreter$$anonfun$resolveImportHooks$2.apply(Interpreter.scala:199)
ammonite.util.Res$$anonfun$1.apply(Res.scala:33)
ammonite.util.Res$$anonfun$1.apply(Res.scala:30)
scala.collection.IndexedSeqOptimized$class.foldl(IndexedSeqOptimized.scala:57)
scala.collection.IndexedSeqOptimized$class.foldLeft(IndexedSeqOptimized.scala:66)
scala.collection.mutable.ArrayBuffer.foldLeft(ArrayBuffer.scala:48)
ammonite.util.Res$.map(Res.scala:30)
ammonite.runtime.Interpreter.resolveImportHooks(Interpreter.scala:199)
ammonite.runtime.Interpreter$$anonfun$processLine$2.apply(Interpreter.scala:213)
ammonite.runtime.Interpreter$$anonfun$processLine$2.apply(Interpreter.scala:209)
ammonite.util.Catching.flatMap(Res.scala:108)
ammonite.runtime.Interpreter.processLine(Interpreter.scala:209)
ammonite.repl.Repl$$anonfun$action$4$$anonfun$apply$2.apply(Repl.scala:88)
ammonite.repl.Repl$$anonfun$action$4$$anonfun$apply$2.apply(Repl.scala:87)
ammonite.repl.Scoped$$anonfun$flatMap$1.apply(Signaller.scala:44)
ammonite.repl.Signaller.apply(Signaller.scala:29)
ammonite.repl.Scoped$class.flatMap(Signaller.scala:44)
ammonite.repl.Signaller.flatMap(Signaller.scala:11)
ammonite.repl.Repl$$anonfun$action$4.apply(Repl.scala:87)
ammonite.repl.Repl$$anonfun$action$4.apply(Repl.scala:74)
ammonite.util.Res$Success.flatMap(Res.scala:57)
ammonite.repl.Repl.action(Repl.scala:74)
ammonite.repl.Repl.loop$1(Repl.scala:98)
ammonite.repl.Repl.run(Repl.scala:117)
ammonite.Main.run(Main.scala:108)
ammonite.Main$$anonfun$main$1$$anonfun$apply$1.apply(Main.scala:249)
ammonite.Main$.ammonite$Main$$ifContinually$1(Main.scala:228)
ammonite.Main$$anonfun$main$1.apply(Main.scala:230)
ammonite.Main$$anonfun$main$1.apply(Main.scala:230)
scala.Option.foreach(Option.scala:257)
ammonite.Main$.main(Main.scala:230)
ammonite.Main.main(Main.scala:-1)
`

@jmccance

This comment has been minimized.

Copy link

jmccance commented Sep 21, 2016

Just ran into the same problem.

∵ amm
Loading...
Welcome to the Ammonite Repl 0.7.7
(Scala 2.11.8 Java 1.8.0_102)
@ import $ivy.`org.typelevel::cats:0.7.0`
:: loading settings :: url = jar:file:/Users/joelm/bin/amm!/org/apache/ivy/core/settings/ivysettings.xml
:: resolving dependencies :: org.typelevel#cats_2.11-caller;working
    confs: [default]
    found org.typelevel#cats_2.11;0.7.0 in central
    found org.scala-lang#scala-library;2.11.8 in chain-resolver
    [2.11.8] org.scala-lang#scala-library;2.11.8
    found org.typelevel#cats-macros_2.11;0.7.0 in central
    found com.github.mpilquist#simulacrum_2.11;0.8.0 in central
    found org.typelevel#macro-compat_2.11;1.1.1 in central
    found org.typelevel#machinist_2.11;0.4.1 in chain-resolver
    found org.scala-lang#scala-reflect;2.11.7 in m2
    found org.typelevel#cats-kernel_2.11;0.7.0 in central
    found org.typelevel#cats-kernel-laws_2.11;0.7.0 in central
    found org.scalacheck#scalacheck_2.11;1.12.5 in chain-resolver
    found org.scala-sbt#test-interface;1.0 in m2
    found org.typelevel#discipline_2.11;0.4 in chain-resolver
    found org.typelevel#catalysts-platform_2.11;0.0.2 in chain-resolver
    found org.typelevel#catalysts-macros_2.11;0.0.2 in chain-resolver
    found org.typelevel#cats-core_2.11;0.7.0 in central
    found org.typelevel#cats-laws_2.11;0.7.0 in central
    found org.typelevel#cats-free_2.11;0.7.0 in central
    found org.typelevel#cats-jvm_2.11;0.7.0 in central
ammonite.runtime.tools.IvyThing$IvyResolutionException: failed to resolve ivy dependencies unresolved dependency: org.scala-lang#scala-reflect;2.11.7: configuration not found in org.scala-lang#scala-reflect;2.11.7: 'master(compile)'. Missing configuration: 'compile'. It was required from org.typelevel#machinist_2.11;0.4.1 compile, unresolved dependency: org.scala-sbt#test-interface;1.0: configuration not found in org.scala-sbt#test-interface;1.0: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalacheck#scalacheck_2.11;1.12.5 compile
  ammonite.runtime.tools.IvyThing.resolveArtifact(IvyThing.scala:108)
  ammonite.runtime.Interpreter.loadIvy(Interpreter.scala:592)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$resolve$2.liftedTree1$1(ImportHook.scala:166)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$resolve$2.apply(ImportHook.scala:166)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$resolve$2.apply(ImportHook.scala:160)
  ammonite.util.Res$Success.flatMap(Res.scala:57)
  ammonite.runtime.ImportHook$BaseIvy.resolve(ImportHook.scala:160)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4$$anonfun$apply$3.apply(ImportHook.scala:175)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4$$anonfun$apply$3.apply(ImportHook.scala:175)
  ammonite.util.Res$$anonfun$1.apply(Res.scala:33)
  ammonite.util.Res$$anonfun$1.apply(Res.scala:30)
  scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
  scala.collection.immutable.List.foldLeft(List.scala:84)
  ammonite.util.Res$.map(Res.scala:30)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4.apply(ImportHook.scala:175)
  ammonite.runtime.ImportHook$BaseIvy$$anonfun$handle$4.apply(ImportHook.scala:174)
  ammonite.util.Res$Success.flatMap(Res.scala:57)
  ammonite.runtime.ImportHook$BaseIvy.handle(ImportHook.scala:174)
  ammonite.runtime.Interpreter$$anonfun$resolveSingleImportHook$3.apply(Interpreter.scala:151)
  ammonite.runtime.Interpreter$$anonfun$resolveSingleImportHook$3.apply(Interpreter.scala:150)
  ammonite.util.Res$Success.flatMap(Res.scala:57)
  ammonite.runtime.Interpreter.resolveSingleImportHook(Interpreter.scala:150)
  ammonite.runtime.Interpreter$$anonfun$resolveImportHooks$2.apply(Interpreter.scala:199)
  ammonite.runtime.Interpreter$$anonfun$resolveImportHooks$2.apply(Interpreter.scala:199)
  ammonite.util.Res$$anonfun$1.apply(Res.scala:33)
  ammonite.util.Res$$anonfun$1.apply(Res.scala:30)
  scala.collection.IndexedSeqOptimized$class.foldl(IndexedSeqOptimized.scala:57)
  scala.collection.IndexedSeqOptimized$class.foldLeft(IndexedSeqOptimized.scala:66)
  scala.collection.mutable.ArrayBuffer.foldLeft(ArrayBuffer.scala:48)
  ammonite.util.Res$.map(Res.scala:30)
  ammonite.runtime.Interpreter.resolveImportHooks(Interpreter.scala:199)
  ammonite.runtime.Interpreter$$anonfun$processLine$2.apply(Interpreter.scala:213)
  ammonite.runtime.Interpreter$$anonfun$processLine$2.apply(Interpreter.scala:209)
  ammonite.util.Catching.flatMap(Res.scala:108)
  ammonite.runtime.Interpreter.processLine(Interpreter.scala:209)
  ammonite.repl.Repl$$anonfun$action$4$$anonfun$apply$2.apply(Repl.scala:88)
  ammonite.repl.Repl$$anonfun$action$4$$anonfun$apply$2.apply(Repl.scala:87)
  ammonite.repl.Scoped$$anonfun$flatMap$1.apply(Signaller.scala:44)
  ammonite.repl.Signaller.apply(Signaller.scala:29)
  ammonite.repl.Scoped$class.flatMap(Signaller.scala:44)
  ammonite.repl.Signaller.flatMap(Signaller.scala:11)
  ammonite.repl.Repl$$anonfun$action$4.apply(Repl.scala:87)
  ammonite.repl.Repl$$anonfun$action$4.apply(Repl.scala:74)
  ammonite.util.Res$Success.flatMap(Res.scala:57)
  ammonite.repl.Repl.action(Repl.scala:74)
  ammonite.repl.Repl.loop$1(Repl.scala:98)
  ammonite.repl.Repl.run(Repl.scala:117)
  ammonite.Main.run(Main.scala:108)
  ammonite.Main$$anonfun$main$1$$anonfun$apply$1.apply(Main.scala:249)
  ammonite.Main$.ammonite$Main$$ifContinually$1(Main.scala:228)
  ammonite.Main$$anonfun$main$1.apply(Main.scala:230)
  ammonite.Main$$anonfun$main$1.apply(Main.scala:230)
  scala.Option.foreach(Option.scala:257)
  ammonite.Main$.main(Main.scala:230)
  ammonite.Main.main(Main.scala:-1)
@olafurpg

This comment has been minimized.

Copy link

olafurpg commented Sep 28, 2016

I bumped into the same issue after updating today. Nuking ~/.ivy2 seems to do the trick. Unfortunately, that means you have to re-download the whole internet on the next sbt update. I do that once in awhile anyways so I don't mind.

Edit. Seems like I still get the same failed to resolve ivy dependencies unresolved dependency: org.scala-lang#scala-library;2.11.8: error in SBT.

@malzzz

This comment has been minimized.

Copy link

malzzz commented Sep 29, 2016

I'm also having the same issue, but with other libraries. Oddly enough, cats imports fine. I can recall at least different libraries that corrupted my ivy cache. Unfortunately I didn't take a mental note of them at the time; however, the latest one was scrimage.

Going through the errors and doing "rm -r ~/.ivy2/cache/com.i-am-totally-corrupted" is a small pita depending on how many directories have to be removed. Purging the entire cache sucks as well from a time-standpoint.

@erik-stripe

This comment has been minimized.

Copy link

erik-stripe commented Oct 9, 2016

@olafurpg I've noticed something similar -- it seems like after I use Ammonite I start observing corrupted jars (i.e. I delete part of the Ivy cache and a particular error resolves). I've stopped using Ammonite-REPL and haven't seen these errors reassert myself. I'm not 100% sure what the cause is but Ammonite-REPL is definitely implicated.

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Oct 9, 2016

Yes I've hit this several times; it's a pain in the neck. Needs to be fixed

@malzzz

This comment has been minimized.

Copy link

malzzz commented Oct 10, 2016

@lihaoyi Do you have an intuition about the source(s) of the bug? If you point me in a general direction, I can perhaps get into it. Just from a cursory look, maybe IvyThing.scala? Going solely off the comments in the file, at least parts of that seem to be a kind of black box.

I haven't had a reason to look into how Ivy functions; however, just from observing the behavior of this issue qua dealing with the issue, I think I've noticed a pattern. That is, the ivy cache seems to get corrupted only when other processes are making use of the ivy cache. If I perform an sbt update on a repo via the terminal at the same time that Intellij tries to perform an update, one of the processes will have to wait on an sbt lock to the appropriate ivy directories. Does ammonite ensure that no other processes are making use of the cache prior to ammonite's operations on it? This is merely my intuition about the issue, which lacks any concrete evidence beyond my potentially fallacious memories about the sequence of events leading up to instances of cache corruption.

@avdv

This comment has been minimized.

Copy link

avdv commented Nov 2, 2016

I also hit this consistently, every time I import a library via ivy2 (which itself or any of its dependencies is not already in the cache).

Here's the current error I'm getting:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: commons-io#commons-io;2.4: configuration not found in commons-io#commons-io;2.4: 'master(compile)'. Missing configuration: 'compile'. It was required from com.typesafe.play#play-doc_2.11;1.2.2 compile
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

The ivy-2.4.xml in ~/.ivy2/cache/commons-io/commons-io looks fishy to me as it is basically empty:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
        <info organisation="commons-io"
                module="commons-io"
                revision="2.4"
                status="release"
                publication="20161102131814"
                default="true"
        />
        <configurations>
                <conf name="default" visibility="public"/>
        </configurations>
        <publications>
                <artifact name="commons-io" type="jar" ext="jar" conf="default"/>
        </publications>
</ivy-module>

whereas after I deleted the file and ran sbt update again, the file contains all sorts of sections, like publications:

 <publications>
      <artifact name="commons-io" type="jar" ext="jar" conf="master"/>
</publications>
@mcanlas

This comment has been minimized.

Copy link

mcanlas commented Nov 23, 2016

Is this still an issue? Does anyone have a minimal reproducible example? Running this in amm seems to work for me.

@ import $ivy.`org.typelevel::cats:0.8.1`
@dsebban

This comment has been minimized.

Copy link

dsebban commented Dec 15, 2016

This is still a big issue

Error:Error while importing SBT project:<br/>...<br/><pre>[info] Resolving org.javassist#javassist;3.18.1-GA ... [info] Resolving org.apache.commons#commons-math;2.2 ... [info] Resolving jline#jline;2.12.1 ... [info] Resolving org.scala-lang#scalap;2.11.7 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: org.apache.commons#commons-lang3;3.1: configuration not found in org.apache.commons#commons-lang3;3.1: 'master(compile)'. Missing configuration: 'compile'. It was required from de.flapdoodle.embed#de.flapdoodle.embed.process;1.50.0 compile [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note: Unresolved dependencies path: [warn] org.apache.commons:commons-lang3:3.1 [warn] +- de.flapdoodle.embed:de.flapdoodle.embed.process:1.50.0 [warn] +- de.flapdoodle.embed:de.flapdoodle.embed.mongo:1.50.0 [trace] Stack trace suppressed: run 'last *:update' for the full output. [trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output. [error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.commons#commons-lang3;3.1: configuration not found in org.apache.commons#commons-lang3;3.1: 'master(compile)'. Missing configuration: 'compile'. It was required from de.flapdoodle.embed#de.flapdoodle.embed.process;1.50.0 compile [error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.apache.commons#commons-lang3;3.1: configuration not found in org.apache.commons#commons-lang3;3.1: 'master(compile)'. Missing configuration: 'compile'. It was required from de.flapdoodle.embed#de.flapdoodle.embed.process;1.50.0 compile

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Dec 15, 2016

Yeah it's still a problem. Hoping that @alexarchambault publishing coursier 1.0 will be the end of our ivy-is-not-behaving problems 😛

@nightscape

This comment has been minimized.

Copy link
Contributor

nightscape commented Jan 4, 2017

I just browsed the issues of coursier, but didn't find one that shows the specific symptoms of this issue. Does anyone know the specific issue (maybe @alexarchambault)? Just to make sure that this problem is known and tracked on the coursier side.

@olafurpg

This comment has been minimized.

Copy link

olafurpg commented Jan 4, 2017

@nightscape I don't think Ammonite uses coursier. To my best understanding, this issue is caused by the ivy resolver, and will hopefully go away once ammonite switches to Coursier v1.0.

@maesenka

This comment has been minimized.

Copy link

maesenka commented Jan 10, 2017

I also ran into this problem, trying to import the amazon AWS SDK library.

On each attempt, Ammonite fails on the import and each time the same entries in the cache get corrupted (commons-logging, com.fasterxml, joda-time, org.apache.httpcomponents). This makes ammonite currently unusable for my project.

@Atry

This comment has been minimized.

Copy link
Contributor

Atry commented Jan 10, 2017

This issue is a regression, as ammonite-repl 0.6.2 never corrupts ivy cache

@drdozer

This comment has been minimized.

Copy link

drdozer commented Jan 20, 2017

I'm seeing this with:

**ammonite.runtime.tools.IvyThing$IvyResolutionException: failed to resolve ivy dependencies unresolved dependency: com.typesafe#config;1.2.1: configuration not found in com.typesafe#config;1.2.1: 'master(compile)'. Missing configuration: 'compile'. It was required from com.typesafe.slick#slick_2.12;3.2.0-M2 compile**

I'd rather not download the universe -- what specifically would I need to surgically nuke to get this to work?

@drdozer

This comment has been minimized.

Copy link

drdozer commented Jan 20, 2017

OK, to make it work I had to rm -rf ~/.ivy2/cache/com.typesafe* and then rerun the import from within amm, not use the sbt ivy downloader.

@Malvolio

This comment has been minimized.

Copy link

Malvolio commented Jan 22, 2017

Whatever the problem was, it stopped happening (for me) with cats 0.9.0.

@NicolaeNMV

This comment has been minimized.

Copy link

NicolaeNMV commented Feb 6, 2017

It happened to me as well with cats 0.9.0 with amm 0.8.2.

@mcorsen

This comment has been minimized.

Copy link

mcorsen commented Mar 20, 2017

I get hit with this one very frequently. It's making ammonite almost unusable for me. The combination of libraries I have a problem with are the typesafe play libs and joda time.

@anatoliykmetyuk

This comment has been minimized.

Copy link

anatoliykmetyuk commented Apr 5, 2017

Same. Tried to import a library that depends on cats from Ammonite, afterwards can't compile any project that depends on cats.

> compile
[info] Updating {file:/Users/anatolii/Projects/free-acp/}core...
[info] Resolving org.scala-lang#scalap;2.12.1 ...
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: org.scala-sbt#test-interface;1.0: configuration not found in org.scala-sbt#test-interface;1.0: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalacheck#scalacheck_2.12;1.13.4 compile
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] 	Note: Unresolved dependencies path:
[warn] 		org.scala-sbt:test-interface:1.0
[warn] 		  +- org.scalacheck:scalacheck_2.12:1.13.4 (/Users/anatolii/Projects/free-acp/build.sbt#L15)
[warn] 		  +- org.typelevel:discipline_2.12:0.7.2
[warn] 		  +- org.typelevel:cats-kernel-laws_2.12:0.8.1 (/Users/anatolii/Projects/free-acp/build.sbt#L15)
[warn] 		  +- org.typelevel:cats-laws_2.12:0.8.1 (/Users/anatolii/Projects/free-acp/build.sbt#L15)
[warn] 		  +- org.typelevel:cats_2.12:0.8.1 (/Users/anatolii/Projects/free-acp/build.sbt#L15)
[warn] 		  +- free-acp:free-acp_2.12:0.1.0

To clean the cache:

find ~/.ivy2 -type d -name "*scala*" -print0 | xargs -0 rm -r
find ~/.ivy2 -type d -name "*sbt*" -print0 | xargs -0 rm -r
@jrudolph

This comment has been minimized.

Copy link
Contributor

jrudolph commented Apr 13, 2017

A likely reason for the corruption are the ~/.ivy2/cache/resolve-<xyz>.xml files. They used to be a problem with sbt as well. At some point per-project resolution directories were introduced in sbt/sbt@c7f6ce4 which seemed to solve that particular problem. (Wait wat that's 5 years ago, oh and my ivy cache also contains files from 2013, now I feel old...)

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented May 18, 2017

Should be fixed by 662859f on my dev branch, which swaps over to using Coursier. Not sure if it has the same bugs, but then it becomes @alexarchambault's problem 😄

@lihaoyi lihaoyi closed this May 18, 2017

@Atry

This comment has been minimized.

Copy link
Contributor

Atry commented May 18, 2017

Seems the import $url. syntax is removed, which I used in http://deeplearning.thoughtworks.school/demo/2.0.0-Preview/SoftmaxLinearClassifier.html

Why not keep URL importing feature?

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented May 18, 2017

It didn't really work; it's implementation was full of ???s. I'm surprised you managed to get it working at all, but if we want to put it back we should do it properly without the ???s 😛

@Atry

This comment has been minimized.

Copy link
Contributor

Atry commented May 19, 2017

Is it possible to implement magic imports as a compiler plugin? So that it can be used in sbt projects.

I really like the feature when sharing small piece of code, especially sharing code between Jupyter Scala and sbt projects.
https://stackoverflow.com/questions/43638987/how-to-reuse-ammonite-repls-sc-files-in-a-sbt-project

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented May 19, 2017

It should be possible, go ahead and give it a shot and see where you end up

@Atry

This comment has been minimized.

Copy link
Contributor

Atry commented May 19, 2017

For import $ivy, we can create a sbt plugin that scan source files and modify libraryDependencies. Unfortunately, this approach requires sbt reload when adding a new library in source files.

For import $file and import $url, we can create a Scala compile plugin that include the file content inline, like #include in C/C++.

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented May 21, 2017

@Atry

This comment has been minimized.

Copy link
Contributor

Atry commented Jun 5, 2017

I create a Scala compiler plugin for magic imports: https://github.com/ThoughtWorksInc/Import.scala

In the plugin, import $file and import $exec support both an absolute URL or a relative file seen from the current file.

I hope I can use the same URL importing feature in Ammonite.

@Atry

This comment has been minimized.

Copy link
Contributor

Atry commented Jul 5, 2017

@lihaoyi I just got $url back in #654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.