{"action":"created","issue":{"url":"https://api.github.com/repos/sksamuel/scalac-scapegoat-plugin/issues/98","labels_url":"https://api.github.com/repos/sksamuel/scalac-scapegoat-plugin/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/sksamuel/scalac-scapegoat-plugin/issues/98/comments","events_url":"https://api.github.com/repos/sksamuel/scalac-scapegoat-plugin/issues/98/events","html_url":"https://github.com/sksamuel/scalac-scapegoat-plugin/issues/98","id":58091178,"number":98,"title":"Scalac error in IntelliJ when using scapegoat as a compiler plugin in a maven project","user":{"login":"rigoford","id":728066,"avatar_url":"https://avatars.githubusercontent.com/u/728066?v=3","gravatar_id":"","url":"https://api.github.com/users/rigoford","html_url":"https://github.com/rigoford","followers_url":"https://api.github.com/users/rigoford/followers","following_url":"https://api.github.com/users/rigoford/following{/other_user}","gists_url":"https://api.github.com/users/rigoford/gists{/gist_id}","starred_url":"https://api.github.com/users/rigoford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rigoford/subscriptions","organizations_url":"https://api.github.com/users/rigoford/orgs","repos_url":"https://api.github.com/users/rigoford/repos","events_url":"https://api.github.com/users/rigoford/events{/privacy}","received_events_url":"https://api.github.com/users/rigoford/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-18T16:31:29Z","updated_at":"2015-02-23T11:04:37Z","closed_at":"2015-02-23T11:04:37Z","body":"I'm trying to use the scalac-scapegoat-plugin within a very simple maven project (one class and one test) with the following config in the pom.xml:\r\n\r\n```xml\r\n\t<build>\r\n\t\t<sourceDirectory>${basedir}/src/main/scala</sourceDirectory>\r\n\t\t<testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>\r\n\t\t<plugins>\r\n\t\t\t<plugin>\r\n\t\t\t\t<groupId>net.alchim31.maven</groupId>\r\n\t\t\t\t<artifactId>scala-maven-plugin</artifactId>\r\n\t\t\t\t<version>${maven.plugin.scala.version}</version>\r\n\t\t\t\t<configuration>\r\n\t\t\t\t\t<scalaCompatVersion>${scala.major.version}</scalaCompatVersion>\r\n\t\t\t\t\t<scalaVersion>${scala.version}</scalaVersion>\r\n\t\t\t\t\t<dependencies>\r\n\t\t\t\t\t\t<dependency>\r\n\t\t\t\t\t\t\t<groupId>com.sksamuel.scapegoat</groupId>\r\n\t\t\t\t\t\t\t<artifactId>scalac-scapegoat-plugin_${scala.major.version}</artifactId>\r\n\t\t\t\t\t\t\t<version>${scalac.plugin.scapegoat.version}</version>\r\n\t\t\t\t\t\t</dependency>\r\n\t\t\t\t\t</dependencies>\r\n\t\t\t\t\t<compilerPlugins>\r\n\t\t\t\t\t\t<compilerPlugin>\r\n\t\t\t\t\t\t\t<groupId>com.sksamuel.scapegoat</groupId>\r\n\t\t\t\t\t\t\t<artifactId>scalac-scapegoat-plugin_${scala.major.version}</artifactId>\r\n\t\t\t\t\t\t\t<version>${scalac.plugin.scapegoat.version}</version>\r\n\t\t\t\t\t\t</compilerPlugin>\r\n\t\t\t\t\t</compilerPlugins>\r\n\t\t\t\t\t<args>\r\n\t\t\t\t\t\t<arg>-P:scapegoat:dataDir:target</arg>\r\n\t\t\t\t\t\t<arg>-P:scapegoat:consoleOutput:true</arg>\r\n\t\t\t\t\t</args>\r\n\t\t\t\t</configuration>\r\n\t\t\t\t<executions>\r\n\t\t\t\t\t<execution>\r\n\t\t\t\t\t\t<goals>\r\n\t\t\t\t\t\t\t<goal>compile</goal>\r\n\t\t\t\t\t\t\t<goal>testCompile</goal>\r\n\t\t\t\t\t\t</goals>\r\n\t\t\t\t\t</execution>\r\n\t\t\t\t</executions>\r\n\t\t\t</plugin>\r\n\t\t</plugins>\r\n\t</build>\r\n```\r\n(appropriate properties having been set).\r\n\r\nRunning `mvn clean verify` from the command line or within IntelliJ (v14.0.3) gives expected output, however if I then try to run the test from within IntelliJ (i.e. `Run 'MyClassSpec'`) the compilation fails with the following error:\r\n\r\n```\r\nError:scalac: Error: object com.sksamuel.scapegoat.Safe in compiler mirror not found.\r\nscala.ScalaReflectionException: object com.sksamuel.scapegoat.Safe in compiler mirror not found.\r\n\tat scala.reflect.internal.Mirrors$RootsBase.staticClass(Mirrors.scala:123)\r\n\tat scala.reflect.internal.Mirrors$RootsBase.staticClass(Mirrors.scala:22)\r\n\tat com.sksamuel.scapegoat.InspectionContext$Traverser$$typecreator2$1.apply(Inspection.scala:49)\r\n\tat scala.reflect.api.TypeTags$WeakTypeTagImpl.tpe$lzycompute(TypeTags.scala:232)\r\n\tat scala.reflect.api.TypeTags$WeakTypeTagImpl.tpe(TypeTags.scala:232)\r\n\tat scala.reflect.api.TypeTags$class.typeOf(TypeTags.scala:341)\r\n\tat scala.reflect.api.Universe.typeOf(Universe.scala:61)\r\n\tat com.sksamuel.scapegoat.InspectionContext$Traverser$class.$init$(Inspection.scala:49)\r\n\tat com.sksamuel.scapegoat.inspections.collections.ArrayEquals$$anon$2$$anon$1.<init>(ArrayEquals.scala:9)\r\n\tat com.sksamuel.scapegoat.inspections.collections.ArrayEquals$$anon$2.postTyperTraverser(ArrayEquals.scala:9)\r\n\tat com.sksamuel.scapegoat.inspections.collections.ArrayEquals$$anon$2.postTyperTraverser(ArrayEquals.scala:8)\r\n\tat com.sksamuel.scapegoat.ScapegoatComponent$Transformer$$anonfun$transform$2.apply(plugin.scala:126)\r\n\tat com.sksamuel.scapegoat.ScapegoatComponent$Transformer$$anonfun$transform$2.apply(plugin.scala:124)\r\n\tat scala.collection.immutable.List.foreach(List.scala:381)\r\n\tat com.sksamuel.scapegoat.ScapegoatComponent$Transformer.transform(plugin.scala:124)\r\n\tat com.sksamuel.scapegoat.ScapegoatComponent$Transformer.transform(plugin.scala:113)\r\n\tat scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:147)\r\n\tat scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)\r\n\tat scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:428)\r\n\tat scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:419)\r\n\tat scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:428)\r\n\tat scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:386)\r\n\tat scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:386)\r\n\tat scala.collection.Iterator$class.foreach(Iterator.scala:743)\r\n\tat scala.collection.AbstractIterator.foreach(Iterator.scala:1195)\r\n\tat scala.tools.nsc.Global$GlobalPhase.run(Global.scala:386)\r\n\tat com.sksamuel.scapegoat.ScapegoatComponent$$anon$1.run(plugin.scala:87)\r\n\tat scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1338)\r\n\tat scala.tools.nsc.Global$Run.compileUnits(Global.scala:1325)\r\n\tat scala.tools.nsc.Global$Run.compileSources(Global.scala:1320)\r\n\tat scala.tools.nsc.Global$Run.compile(Global.scala:1418)\r\n\tat xsbt.CachedCompiler0.run(CompilerInterface.scala:126)\r\n\tat xsbt.CachedCompiler0.run(CompilerInterface.scala:102)\r\n\tat xsbt.CompilerInterface.run(CompilerInterface.scala:27)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n\tat sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102)\r\n\tat sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)\r\n\tat sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)\r\n\tat org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:29)\r\n\tat org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)\r\n\tat org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:62)\r\n\tat org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:20)\r\n\tat org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n\tat com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)\r\n```\r\n\r\nDo you have any idea what the issue may be? I can provide the simple project if necessary.\r\n\r\nMany thanks\r\n\r\nMartin"},"comment":{"url":"https://api.github.com/repos/sksamuel/scalac-scapegoat-plugin/issues/comments/75523610","html_url":"https://github.com/sksamuel/scalac-scapegoat-plugin/issues/98#issuecomment-75523610","issue_url":"https://api.github.com/repos/sksamuel/scalac-scapegoat-plugin/issues/98","id":75523610,"user":{"login":"rigoford","id":728066,"avatar_url":"https://avatars.githubusercontent.com/u/728066?v=3","gravatar_id":"","url":"https://api.github.com/users/rigoford","html_url":"https://github.com/rigoford","followers_url":"https://api.github.com/users/rigoford/followers","following_url":"https://api.github.com/users/rigoford/following{/other_user}","gists_url":"https://api.github.com/users/rigoford/gists{/gist_id}","starred_url":"https://api.github.com/users/rigoford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rigoford/subscriptions","organizations_url":"https://api.github.com/users/rigoford/orgs","repos_url":"https://api.github.com/users/rigoford/repos","events_url":"https://api.github.com/users/rigoford/events{/privacy}","received_events_url":"https://api.github.com/users/rigoford/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T11:04:37Z","updated_at":"2015-02-23T11:04:37Z","body":"If I add the com.sksamuel.scapegoat:scalac-scapegoat-plugin_2.11 dependency as a 'normal' maven dependency and not a compiler dependency I do not get the\r\n\r\n\"Error:scalac: Error: object com.sksamuel.scapegoat.Safe in compiler mirror not found. scala.ScalaReflectionException: object com.sksamuel.scapegoat.Safe in compiler mirror not found.\"\r\n\r\nerror, however I do get a similar error for a scala-xml class. Adding this as a normal maven dependency removes that error and IntelliJ seems to build the project and run the test fine.  Although I'm not convinced of the stability of this.\r\n\r\nLooking at the scala-maven-plugin [documentation](http://davidb.github.io/scala-maven-plugin/example_scalac_plugins.html), it recommends that:\r\n\r\n\"A scalac plugin should only have dependencies on the scala-compiler artifact, and these dependencies should be of type \"provided\".\"\r\n\r\nIt seems that this is the source of the issue."}}