Skip to content

Commit

Permalink
feat(maven-container): add mvnOpts field and remove default option
Browse files Browse the repository at this point in the history
Skipping the unit tests was previously done to separate that step
from the build, but it turns out to be counterproductive since it just
slows down and complicates the overall flow.
  • Loading branch information
edvald committed Mar 18, 2019
1 parent 75caab2 commit 187dc7d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions garden-service/src/plugins/maven-container/maven-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ContainerModuleConfig,
ContainerTaskSpec,
} from "../container/config"
import { validateWithPath } from "../../config/common"
import { validateWithPath, joiArray } from "../../config/common"
import { BuildModuleParams, ConfigureModuleParams, GetBuildStatusParams } from "../../types/plugin/params"
import { Module } from "../../types/module"
import { configureContainerModule, gardenPlugin as containerPlugin } from "../container/container"
Expand All @@ -37,7 +37,7 @@ const defaultDockerfilePath = resolve(STATIC_DIR, "maven-container", "Dockerfile
interface MavenContainerModuleSpec extends ContainerModuleSpec {
jarPath: string
jdkVersion: number
mvnArgs: string[]
mvnOpts: string[]
}

// type MavenContainerModuleConfig = ModuleConfig<MavenContainerModuleSpec>
Expand All @@ -59,6 +59,8 @@ const mavenKeys = {
.allow(8, 11)
.default(8)
.description("The JDK version to use."),
mvnOpts: joiArray(Joi.string())
.description("Options to add to the `mvn package` command when building."),
}

const mavenFieldsSchema = Joi.object()
Expand Down Expand Up @@ -131,7 +133,7 @@ async function getBuildStatus(params: GetBuildStatusParams<MavenContainerModule>
async function build(params: BuildModuleParams<MavenContainerModule>) {
// Run the maven build
const { ctx, module, log } = params
let { jarPath, jdkVersion } = module.spec
let { jarPath, jdkVersion, mvnOpts } = module.spec

const pom = await loadPom(module.path)
const artifactId = get(pom, ["project", "artifactId", "_text"])
Expand All @@ -148,9 +150,9 @@ async function build(params: BuildModuleParams<MavenContainerModule>) {
const mvnArgs = [
"package",
"--batch-mode",
"-DskipTests",
"--projects", ":" + artifactId,
"--also-make",
...mvnOpts,
]
const mvnCmdStr = "mvn " + mvnArgs.join(" ")

Expand Down

0 comments on commit 187dc7d

Please sign in to comment.