geotrellis / vectorpipe

Convert Vector data to VectorTiles with GeoTrellis.
https://geotrellis.github.io/vectorpipe/
Other
74 stars 20 forks source link

using sbt-shell to build this project cause error: java.util.NoSuchElementException: None.get #137

Closed dh12313012 closed 4 years ago

dh12313012 commented 4 years ago

Because of network limitations, i use sbt shell build this project. And system report an error :

Listening for transport dt_socket at address: 50341
[info] Loading settings for project global-plugins from idea4.sbt ...
[info] Loading global plugins from C:\Users\dh123\.sbt\1.0\plugins
[info] Loading settings for project vectorpipe-master-build from assembly.sbt,plugins.sbt ...
[info] Loading project definition from E:\workspace\speedchine\vectorpipe-master\project
[info] Loading settings for project vectorpipe from build.sbt ...
[error] java.util.NoSuchElementException: None.get
[error]         at scala.None$.get(Option.scala:349)
[error]         at scala.None$.get(Option.scala:347)
[error]         at $1d6b667f79f8f60b7d9d$.$anonfun$commonSettings$1(build.sbt:13)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:221)
[error]         at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:164)
[error]         at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
[error]         at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:98)
[error]         at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? [error] java.util.NoSuchElementException: None.get
[error] Use 'last' for the full log.

build.sbt context :

import xerial.sbt.Sonatype._
import Dependencies._

lazy val commonSettings = Seq(
  // We are overriding the default behavior of sbt-git which, by default,
  // only appends the `-SNAPSHOT` suffix if there are uncommitted
  // changes in the workspace.
  version := {
    // Avoid Cyclic reference involving error
    if (git.gitCurrentTags.value.isEmpty || git.gitUncommittedChanges.value)
      git.gitDescribedVersion.value.get + "-SNAPSHOT"
    else
      git.gitDescribedVersion.value.get
  },

...

system warn that git.gitDescribedVersion.value.get + "-SNAPSHOT" errors

I am a nood in sbt, how to resolve this problem?

dh12313012 commented 4 years ago

plugins.sbt contains sbt-git:

addSbtPlugin("com.47deg"  % "sbt-microsites" % "0.7.4")

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.27")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0")

addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.5")

addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.2.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
pomadchin commented 4 years ago

Hi @dh12313012 ! I think git.gitDescribedVersion.value.get when you're trying to start sbt project outside of a folder git / repo without commits / etc; try the following:

version := {
  if(git.gitHeadCommit.value.isEmpty) "0.0.1-SNAPSHOT"
  else if (git.gitDescribedVersion.value.isEmpty)
    git.gitHeadCommit.value.get.substring(0, 7) + "-SNAPSHOT"
  else if (git.gitCurrentTags.value.isEmpty || git.gitUncommittedChanges.value)
    git.gitDescribedVersion.value.get + "-SNAPSHOT"
  else
    git.gitDescribedVersion.value.get
}
dh12313012 commented 4 years ago

Hi, @pomadchin !Thanks for your help. This modification solved my problem. 👍