Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT: compile & package -- "working tree not clean"

I am working on a Scala extension for NetLogo (repo). I am following both the Extension API example and NetLogos Sample-Scala-Extension.

I am seeing:

[info] Done packaging.
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>
[warn] working tree not clean when packaging; target not created
[success] Total time: 6 s, completed Jan 29, 2019, 6:22:00 PM

The .jar that is generated does not contain modifications I made to the extension. I think it has something to do with "[warn] working tree not clean...".

Is this the case? What is the solution?

File hierarchy:

Scala-Plume-Model
  build.sbt
  src 
    PlumeModelExtension.scala       


build.sbt

enablePlugins(org.nlogo.build.NetLogoExtension)

name := "plume-scala"
version := "0.1"
scalaVersion := "2.12.0"

netLogoExtName      := "plume-scala"
netLogoClassManager := "PlumeModelExtension"
netLogoZipSources   := false

scalaSource in Compile := baseDirectory.value / "src"
scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xfatal-warnings", "-encoding", "us-ascii")
netLogoVersion := "6.0.4"
like image 753
bcr Avatar asked Jan 30 '19 00:01

bcr


1 Answers

The short answer: add isSnapshot := true to your build.sbt and then the package sbt task should start creating the output jar and zip files regardless of the current status of git.

Longer answer: The NetLogo Extension SBT plugin has some expectations about when packaging will occur. If isSnapshot is false or unset, the plugin assumes you're trying to do a "production" release. But for a production release you probably do not want to compile and package off of a dirty repository. So it warns you and does not create the artifacts.

The normal workflow would be to keep isSnapshot := true while you're in development, then once you have all your commits done and are ready for a release, add a commit to set isSnapshot := false (maybe along with a version bump for the extension), package and tag the release, then add a commit setting isSnapshot := true right away.

like image 195
Jasper Avatar answered Oct 13 '22 13:10

Jasper