Skip to content

Commit

Permalink
make the server executable: #51 (#66)
Browse files Browse the repository at this point in the history
* Fixes #51

* Fixes #51

* Fixes #51 - Added sbt-web plugin

* Fixes #51

* Fixes #51

* Fixes #51 - removed dead code

* Fixes #51 - Added some sbt plugins

* Fixes #51

* Fixes #51

* Fixes #51

* Fixes #51

* Fixes #51

* #51: adding merge strategy during assembly operation

* #51: refactoring to newer syntax

* #51: doc update, IntelliJ run on localhost

---------

Co-authored-by: Ladislav Sulak <[email protected]>
  • Loading branch information
TebaleloS and lsulak authored Sep 21, 2023
1 parent aec3c76 commit 9d648f9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ Code coverage wil be generated on path:
{project-root}/atum-service-test/target/jvm-{scala_version}/jacoco/report/html
```

## How to Run in IntelliJ

To make this project runnable via IntelliJ, do the following:
- Make sure that your Spring related configuration in `server/src/main/resources/application.properties`
is configured according to your needs
- Create a new Spring Boot configuration (see the screenshot below)

![Intellij Spring Boot Run Configuration](https://github.com/AbsaOSS/atum-service/assets/5686168/63648615-03eb-45fb-99b3-f09e9aeebbb4")
Intellij Run Configuration for Spring Boot, Server configuration

## How to Release

Please see [this file](RELEASE.md) for more details.
Please see [this file](RELEASE.md) for more details.
24 changes: 18 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import Dependencies._
import SparkVersionAxis._
import JacocoSetup._
import sbt.Keys.name

ThisBuild / organization := "za.co.absa.atum-service"

Expand Down Expand Up @@ -46,11 +47,19 @@ lazy val commonSettings = Seq(
Test / parallelExecution := false
)

val mergeStrategy: Def.SettingsDefinition = assembly / assemblyMergeStrategy := {
case PathList("META-INF", _) => MergeStrategy.discard
case "application.conf" => MergeStrategy.concat
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
}

lazy val parent = (project in file("."))
.aggregate(atumServer.projectRefs ++ atumAgent.projectRefs: _*)
.settings(
name := "atum-service-parent",
publish / skip := true
publish / skip := true,
mergeStrategy
)

lazy val atumAgent = (projectMatrix in file("agent"))
Expand All @@ -59,7 +68,8 @@ lazy val atumAgent = (projectMatrix in file("agent"))
name := "atum-agent",
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value,
scalafmtOnCompile := true
)
),
mergeStrategy
)
.enablePlugins(ScalafmtPlugin)
.sparkRow(SparkVersionAxis(spark2), scalaVersions = Seq(scala211, scala212))
Expand All @@ -70,19 +80,21 @@ lazy val atumServer = (projectMatrix in file("server"))
commonSettings ++ Seq(
name := "atum-server",
libraryDependencies ++= Dependencies.serverDependencies,
Compile / packageBin / publishArtifact := false,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value,
packageBin := (Compile / assembly).value,
artifactPath / (Compile / packageBin) := baseDirectory.value / s"target/${name.value}-${version.value}.war",
webappWebInfClasses := true,
inheritJarManifest := true
inheritJarManifest := true,
mergeStrategy
): _*
)
.settings(
jacocoReportSettings := jacocoSettings( scalaVersion.value, "atum-server"),
jacocoExcludes := jacocoProjectExcludes()
)
.enablePlugins(AssemblyPlugin)
.enablePlugins(TomcatPlugin)
.enablePlugins(AutomateHeaderPlugin)
.jvmPlatform(scalaVersions = Seq(scala212))




9 changes: 4 additions & 5 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,28 @@ object Dependencies {
}

def commonDependencies: Seq[ModuleID] = Seq(
"org.scalatest" %% "scalatest" % "3.2.2" % Test,
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
"org.mockito" %% "mockito-scala" % "1.17.12" % Test
)

def serverDependencies: Seq[ModuleID] = {

val springVersion = "2.6.1"
val springOrg = "org.springframework.boot"

lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.9"
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.15"
lazy val springBootWeb = springOrg % "spring-boot-starter-web" % springVersion
lazy val springBootConfiguration = springOrg % "spring-boot-configuration-processor" % springVersion
lazy val springBootTomcat = springOrg % "spring-boot-starter-tomcat" % springVersion
lazy val springBootTest = springOrg % "spring-boot-starter-test" % springVersion
lazy val servletApi = "javax.servlet" % "javax.servlet-api" % "3.0.1"
lazy val servletApi = "javax.servlet" % "javax.servlet-api" % "4.0.1"
lazy val springFoxSwagger = "io.springfox" % "springfox-swagger2" % "3.0.0"
lazy val springFoxBoot = "io.springfox" % "springfox-boot-starter" % "3.0.0"
lazy val springFoxSwaggerUI = "io.springfox" % "springfox-swagger-ui" % "3.0.0"

// controller implicits: java CompletableFuture -> scala Future
lazy val scalaJava8Compat = "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.2"
// object mapper serialization
lazy val jacksonModuleScala = "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.13.1"
lazy val jacksonModuleScala = "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.14.2"


Seq(
Expand Down
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.1")
// To add release plugin
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

// Plugins to build the server module as a war file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")

// sbt-jacoco dependency downloading
lazy val ow2Version = "9.5"
lazy val jacocoVersion = "0.8.11-absa.1"
Expand Down

0 comments on commit 9d648f9

Please sign in to comment.