giter8 icon indicating copy to clipboard operation
giter8 copied to clipboard

Giter8 template not working on non-default sbt version

Open Amndeep7 opened this issue 7 years ago • 3 comments

When you run g8 foundweekends/giter8.g8 it gives you the option to set the sbt_version. The default version number is 0.13.16-M1 (which seems questionable to me since it's a pre-release). When you run sbt on the top-level project generated by the g8 command, it works just fine. When you change the version of sbt to something else (the two I tested were 0.13.15 and 0.13.13) during the configuration step in the g8 command and then try to run sbt again, there is an incompatible plugins exception:

Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? last
[info] Loading project definition from /path_to/testing/project
[debug] [naha]
[debug] [naha] Initial source changes:
[debug] [naha] 	removed:Set()
[debug] [naha] 	added: Set()
[debug] [naha] 	modified: Set()
[debug] [naha] Invalidated products: Set()
[debug] [naha] External API changes: API Changes: Set()
[debug] [naha] Modified binary dependencies: Set()
[debug] [naha] Initial directly invalidated sources: Set()
[debug] [naha]
[debug] [naha] Sources indirectly invalidated by:
[debug] [naha] 	product: Set()
[debug] [naha] 	binary dep: Set()
[debug] [naha] 	external source: Set()
[debug] All initially invalidated sources: Set()
[debug] Copy resource mappings:
[debug]
[debug] Forcing garbage collection...
sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.
Note that conflicts were resolved for some dependencies:
	org.codehaus.plexus:plexus-utils
	org.scala-sbt:sbt
	at sbt.PluginDiscovery$.incompatiblePlugins(PluginDiscovery.scala:145)
	at sbt.PluginDiscovery$.loadModules(PluginDiscovery.scala:135)
	at sbt.PluginDiscovery$.binarySourceModules(PluginDiscovery.scala:124)
	at sbt.PluginDiscovery$.discover$1(PluginDiscovery.scala:28)
	at sbt.PluginDiscovery$.discoverAll(PluginDiscovery.scala:43)
	at sbt.Load$.loadPlugins(Load.scala:900)
	at sbt.Load$.loadPluginDefinition(Load.scala:857)
	at sbt.Load$.buildPlugins(Load.scala:852)
	at sbt.Load$.plugins(Load.scala:840)
	at sbt.Load$$anonfun$loadUnit$1$$anonfun$34.apply(Load.scala:465)
	at sbt.Load$$anonfun$loadUnit$1$$anonfun$34.apply(Load.scala:465)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$$anonfun$loadUnit$1.apply(Load.scala:464)
	at sbt.Load$$anonfun$loadUnit$1.apply(Load.scala:459)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.loadUnit(Load.scala:459)
	at sbt.Load$$anonfun$25$$anonfun$apply$14.apply(Load.scala:311)
	at sbt.Load$$anonfun$25$$anonfun$apply$14.apply(Load.scala:310)
	at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:91)
	at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:90)
	at sbt.BuildLoader.apply(BuildLoader.scala:140)
	at sbt.Load$.loadAll(Load.scala:365)
	at sbt.Load$.loadURI(Load.scala:320)
	at sbt.Load$.load(Load.scala:316)
	at sbt.Load$.load(Load.scala:305)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.apply(Load.scala:146)
	at sbt.Load$.defaultLoad(Load.scala:39)
	at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:548)
	at sbt.BuiltinCommands$.doLoadProject(Main.scala:548)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:540)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:540)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$.process(Command.scala:93)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.State$$anon$1.doX$1(State.scala:183)
	at sbt.State$$anon$1.process(State.scala:190)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.MainLoop$.next(MainLoop.scala:96)
	at sbt.MainLoop$.run(MainLoop.scala:89)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
	at sbt.Using.apply(Using.scala:24)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
	at sbt.MainLoop$.runLogged(MainLoop.scala:22)
	at sbt.StandardMain$.runManaged(Main.scala:109)
	at sbt.xMain.run(Main.scala:38)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
	at xsbt.boot.Launch$.run(Launch.scala:109)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
	at xsbt.boot.Launch$.launch(Launch.scala:117)
	at xsbt.boot.Launch$.apply(Launch.scala:18)
	at xsbt.boot.Boot$.runImpl(Boot.scala:41)
	at xsbt.boot.Boot$.main(Boot.scala:17)
	at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.NoSuchMethodError: sbt.Keys$.pluginCrossBuild()Lsbt/TaskKey;
	at sbt.ScriptedPlugin$.<init>(ScriptedPlugin.scala:101)
	at sbt.ScriptedPlugin$.<clinit>(ScriptedPlugin.scala)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:14)
	at sbt.ModuleUtilities$.getCheckedObject(ModuleUtilities.scala:20)
	at sbt.ModuleUtilities$$anonfun$getCheckedObjects$1.apply(ModuleUtilities.scala:23)
	at sbt.ModuleUtilities$$anonfun$getCheckedObjects$1.apply(ModuleUtilities.scala:23)
	at scala.collection.immutable.Stream.map(Stream.scala:376)
	at sbt.ModuleUtilities$.getCheckedObjects(ModuleUtilities.scala:23)
	at sbt.PluginDiscovery$.loadModules(PluginDiscovery.scala:130)
	at sbt.PluginDiscovery$.binarySourceModules(PluginDiscovery.scala:124)
	at sbt.PluginDiscovery$.discover$1(PluginDiscovery.scala:28)
	at sbt.PluginDiscovery$.discoverAll(PluginDiscovery.scala:43)
	at sbt.Load$.loadPlugins(Load.scala:900)
	at sbt.Load$.loadPluginDefinition(Load.scala:857)
	at sbt.Load$.buildPlugins(Load.scala:852)
	at sbt.Load$.plugins(Load.scala:840)
	at sbt.Load$$anonfun$loadUnit$1$$anonfun$34.apply(Load.scala:465)
	at sbt.Load$$anonfun$loadUnit$1$$anonfun$34.apply(Load.scala:465)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$$anonfun$loadUnit$1.apply(Load.scala:464)
	at sbt.Load$$anonfun$loadUnit$1.apply(Load.scala:459)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.loadUnit(Load.scala:459)
	at sbt.Load$$anonfun$25$$anonfun$apply$14.apply(Load.scala:311)
	at sbt.Load$$anonfun$25$$anonfun$apply$14.apply(Load.scala:310)
	at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:91)
	at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:90)
	at sbt.BuildLoader.apply(BuildLoader.scala:140)
	at sbt.Load$.loadAll(Load.scala:365)
	at sbt.Load$.loadURI(Load.scala:320)
	at sbt.Load$.load(Load.scala:316)
	at sbt.Load$.load(Load.scala:305)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.apply(Load.scala:146)
	at sbt.Load$.defaultLoad(Load.scala:39)
	at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:548)
	at sbt.BuiltinCommands$.doLoadProject(Main.scala:548)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:540)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:540)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$.process(Command.scala:93)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.State$$anon$1.doX$1(State.scala:183)
	at sbt.State$$anon$1.process(State.scala:190)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.MainLoop$.next(MainLoop.scala:96)
	at sbt.MainLoop$.run(MainLoop.scala:89)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
	at sbt.Using.apply(Using.scala:24)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
	at sbt.MainLoop$.runLogged(MainLoop.scala:22)
	at sbt.StandardMain$.runManaged(Main.scala:109)
	at sbt.xMain.run(Main.scala:38)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
	at xsbt.boot.Launch$.run(Launch.scala:109)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
	at xsbt.boot.Launch$.launch(Launch.scala:117)
	at xsbt.boot.Launch$.apply(Launch.scala:18)
	at xsbt.boot.Boot$.runImpl(Boot.scala:41)
	at xsbt.boot.Boot$.main(Boot.scala:17)
	at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.
[error] Note that conflicts were resolved for some dependencies:
[error] 	org.codehaus.plexus:plexus-utils
[error] 	org.scala-sbt:sbt
[error] Use 'last' for the full log.
[debug] > load-failed
[debug] > last

If you go to the template within the project and run sbt, it works just fine.

If you change the build.properties file in /path_to/testing/project to be 0.13.16-M1, but leave the one in the template as whatever you want (ex. 0.13.15), it works just fine. To me, it means that either the configuration process when running g8 is mistakenly also changing the version of sbt being used in the project or you have a dependency (the plexus-utils one presumably) that is tied to a particular version of sbt as opposed to changing depending on what's asked for in the configuration process.

Amndeep7 avatar Jul 07 '17 17:07 Amndeep7

Thanks for the report!

This is happening because Giter8's plugin directly depends on Scripted. Maybe this is something we can work around on the Giter8's side by providing a shim.

eed3si9n avatar Jul 21 '17 16:07 eed3si9n

foundweekends/giter8.g8 has updated the sbt version. Failing to accept the default sbt_version still gives the binary incompatibility error.

Accepting the defaults (giter8_version 0.9.0, sbt_version 0.13.16) and running SBT in the resulting template project gives:

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] 	* org.codehaus.plexus:plexus-utils:3.0.18 is selected over 1.0.4
[warn] 	    +- org.codehaus.plexus:plexus-archiver:2.7.1          (depends on 1.0.4)
[warn] 	    +- org.codehaus.plexus:plexus-io:2.2                  (depends on 1.0.4)
[warn] 	    +- org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1 (depends on 1.0.4)
[warn]
[warn] Run 'evicted' to see detailed eviction warnings

This is a warning, and I haven't encountered any actual issues with this yet, but I'm just getting started.

randomstatistic avatar Sep 07 '17 17:09 randomstatistic

I am facing the same issue, I have tried to change sbt version to 0.13 but still getting the error. Is there a way to fix it?

elbaulp avatar Nov 05 '18 15:11 elbaulp