alpakka icon indicating copy to clipboard operation
alpakka copied to clipboard

Unable to load the sbt project in IntelliJ with error: "Unable to determine previous version"

Open Daniel-Khodabakhsh opened this issue 2 years ago • 2 comments

First time loading Alpakka with IntelliJ from the master branch synced just today and I get the error: Unable to determine previous version from method alpakkaProject in build.sbt.

Looks like alpakkaProject is used to load the projects and my error is happening when it's trying to load the mimaPreviousArtifacts setting for a project.

Is there a step I'm missing in my setup? I noticed the pipeline uses JDK 11 and i'm on JDK 17 but I have other scala 2.13.8 + sbt 1.5.8 projects that run on JDK 17 without issues so I feel like this isn't the problem.

Versions used

Akka version: 2.6.19 IntelliJ IDEA version: 2022.2.1

Expected Behavior

Should be able to open the project in IntelliJ and sbt should be able to load the projects.

Actual Behavior

When I open the project and let IntelliJ load the build.sbt file (or if I manually trigger loading build.sbt) I get the following error:

image

Ran the project load using the sbt shell setting in IntelliJ which results in the same error:

image

Relevant logs

C:/Program Files/Eclipse Adoptium/jdk-17.0.2.8-hotspot/bin/java.exe -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -Dfile.encoding=UTF8 -Xms1g -Xss6M -Didea.managed=true -Dfile.encoding=UTF-8 -Didea.installation.dir=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.2 -jar C:/Users/Dan/AppData/Roaming/JetBrains/IdeaIC2022.2/plugins/Scala/launcher/sbt-launch.jar
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by sbt.TrapExit$ (file:/C:/Users/Dan/.sbt/boot/scala-2.12.14/org.scala-sbt/sbt/1.5.8/run_2.12-1.5.8.jar)
WARNING: Please consider reporting this to the maintainers of sbt.TrapExit$
WARNING: System::setSecurityManager will be removed in a future release
[info] welcome to sbt 1.5.8 (Eclipse Adoptium Java 17.0.2)
[info] loading global plugins from C:\Users\Dan\.sbt\1.0\plugins
[info] loading settings for project alpakka-build from plugins.sbt ...
[info] loading project definition from D:\Projects\GitHub\akka\alpakka\project
[info] loading settings for project alpakka from build.sbt ...
[info] resolving key references (65045 settings) ...
java.lang.Error: Unable to determine previous version
at $eff41a0f436e6bc734f4$.$anonfun$alpakkaProject$3(build.sbt:438)
at scala.Option.getOrElse(Option.scala:189)
at $eff41a0f436e6bc734f4$.$anonfun$alpakkaProject$2(build.sbt:438)
at scala.Function1.$anonfun$compose$1(Function1.scala:49)
at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228)
at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170)
at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
[error] java.lang.Error: Unable to determine previous version
[error] Use 'last' for the full log.

Reproducible Test Case

  1. Install Eclipse Adoptium JDK 17
  2. git clone the Alpakka project.
  3. Try to open Alpakka with IntelliJ

Daniel-Khodabakhsh avatar Aug 19 '22 00:08 Daniel-Khodabakhsh

Can you try to run sbt Test/compile from the shell before importing, please?

ennru avatar Aug 21 '22 13:08 ennru

Sure thing @ennru !

Note: I'm using IntelliJ's sbt launcher plugin instead of a separate sbt installation. (this works fine for projects such as Slick).

When I try to open the sbt shell it gives me the following error:

image

"C:\Program Files\Eclipse Adoptium\jdk-17.0.2.8-hotspot\bin\java.exe" -server -Xmx1536M -Dsbt.supershell=false -Dfile.encoding=UTF8 -Xms1g -Xss6M -Didea.managed=true -Dfile.encoding=UTF-8 "-Didea.installation.dir=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.2" -Dsbt.log.noformat=true -jar C:\Users\Dan\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\Scala\launcher\sbt-launch.jar early(addPluginSbtFile=\"\"\"C:\Users\Dan\AppData\Local\Temp\idea2.sbt\"\"\") "; set ideaPort in Global := 62612 ; idea-shell"
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by sbt.TrapExit$ (file:/C:/Users/Dan/.sbt/boot/scala-2.12.14/org.scala-sbt/sbt/1.5.8/run_2.12-1.5.8.jar)
WARNING: Please consider reporting this to the maintainers of sbt.TrapExit$
WARNING: System::setSecurityManager will be removed in a future release
[info] welcome to sbt 1.5.8 (Eclipse Adoptium Java 17.0.2)
[info] loading global plugins from C:\Users\Dan\.sbt\1.0\plugins
[info] loading settings for project alpakka-build from plugins.sbt,idea2.sbt ...
[info] loading project definition from D:\Projects\GitHub\akka\alpakka\project
[info] loading settings for project alpakka from build.sbt ...
[info] resolving key references (66279 settings) ...
java.lang.Error: Unable to determine previous version
        at $fc85d3c0a85c51411323$.$anonfun$alpakkaProject$3(build.sbt:438)
        at scala.Option.getOrElse(Option.scala:189)
        at $fc85d3c0a85c51411323$.$anonfun$alpakkaProject$2(build.sbt:438)
        at scala.Function1.$anonfun$compose$1(Function1.scala:49)
        at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228)
        at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170)
        at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
        at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
        at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
[error] java.lang.Error: Unable to determine previous version
[error] Use 'last' for the full log.

Daniel-Khodabakhsh avatar Aug 21 '22 16:08 Daniel-Khodabakhsh

Did you do a shallow clone/git fetch of the repo? The build needs to find the previous version tag in the git history.

ennru avatar Nov 09 '22 11:11 ennru

No @ennru, I did a regular git clone, as in git clone https://github.com/akka/alpakka.git.

Just did a git pull and tested again but no luck.

Based on what you're saying, I checked if git is in my PATH and it wasn't. Adding it solved the issue.

Would it be possible to update the documentation (either README.md or CONTRIBUTING.md) to include this needed step? Or alternatively use a different plugin which includes its own git executable?

Daniel-Khodabakhsh avatar Nov 09 '22 14:11 Daniel-Khodabakhsh

Thanks for trying again and identifying the reason. You're right, the sbt MiMa plugin uses git from the path. Would you be in a position to suggest an update to the contributor instructions?

ennru avatar Nov 09 '22 14:11 ennru

Sure thing @ennru! I've just created a pull request now: https://github.com/akka/alpakka/pull/2938 Do I keep this issue open until the PR is merged? Otherwise feel free to close this issue.

Daniel-Khodabakhsh avatar Nov 09 '22 17:11 Daniel-Khodabakhsh