ZGIS / smart-csw-ingester

CSW to Lucene Index
Apache License 2.0
0 stars 1 forks source link

build.sbt build options #2

Closed allixender closed 8 years ago

allixender commented 8 years ago

Evaluate and decide compile and config options for improved code style, quality and ci / packaging

[x] JVM base version presumably 1.8_xx thus, source/target jvm settings n/a [x] Findbugs? or was it for Java only? -> Code enhancements, #3 [x] Docker / JavaApp packaging

e.g. Java and Scala Compiler settings examples

javacOptions in Compile ++= Seq(
  "-encoding", "UTF-8",
  "-source", "1.7",
  "-target", "1.7",
  "-g",
  "-Xlint:-path",
  "-Xlint:deprecation",
  "-Xlint:unchecked"
)
scalacOptions in ThisBuild ++= Seq(
  "-target:jvm-1.7",
  "-encoding", "UTF-8",
  "-deprecation", // warning and location for usages of deprecated APIs
  "-feature", // warning and location for usages of features that should be imported explicitly
  "-unchecked", // additional warnings where generated code depends on assumptions
  "-Xlint", // recommended additional warnings
  "-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
  "-Ywarn-value-discard", // Warn when non-Unit expression results are unused
  "-Ywarn-inaccessible",
  "-Ywarn-dead-code",
  "-language:reflectiveCalls"
)
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
import de.johoop.findbugs4sbt.FindBugs._
import com.typesafe.sbt.packager.docker._

sbt findbugs settings example

findbugsSettings

findbugsExcludeFilters := Some(
  <FindBugsFilter>
    <!-- See docs/examples at http://findbugs.sourceforge.net/manual/filter.html -->
    <Match>
      <Class name="~views\.html\..*"/>
    </Match>
    <Match>
      <Class name="~Routes.*"/>
    </Match>
    <Match>
      <Class name="~controllers\.routes.*"/>
    </Match>
  </FindBugsFilter>
)

Java Docker packaging example:

version in Docker := version.value

maintainer in Docker := "allixender@googlemail.com"

dockerBaseImage in Docker := "java:8-jre"

dockerBaseImage := "java:8-jre"

javaOptions in Universal ++= Seq(
  // others will be added as app parameters
 // "-DapplyEvolutions.default=true",
  "-Dconfig.resource=prod.application.conf"
  //"-Dapplication.base_url=http://test.smart-project.info/"
)
allixender commented 8 years ago

For Play 2.5 JDK 1.8 is compulsory

allixender commented 8 years ago

If we don't use Java sources eg for Lucene or MEtadata XMLBeans or something like that, then we don't need JavacOptions.

allixender commented 8 years ago

https://github.com/ZGIS/smart-csw-ingester/commit/2f11c6a3260ef06cb8207766844855108137bd67

scalacoption and Docker JavaApp packaging enabled