Skip to content

Commit

Permalink
Maven invoker using Gradle Java toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Aug 25, 2021
1 parent a1e5132 commit cacb111
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=1.0.35
version=1.0.36
release.useAutomaticVersion=true

# Performance tuning
Expand Down
15 changes: 13 additions & 2 deletions src/main/kotlin/com/cognifide/gradle/common/mvn/MvnInvoker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import java.io.File

class MvnInvoker(private val common: CommonExtension) {

val workingDir = common.obj.dir()
val workingDir = common.obj.dir() {
convention(common.project.layout.projectDirectory)
}

fun workingDir(dir: File) {
workingDir.set(dir)
Expand Down Expand Up @@ -52,7 +54,16 @@ class MvnInvoker(private val common: CommonExtension) {
args.addAll(values)
}

private var specOptions: ExecSpec.() -> Unit = {}
val javaToolchain = common.obj.boolean {
convention(true)
common.prop.boolean("mvn.javaToolchain")?.let { set(it) }
}

private var specOptions: ExecSpec.() -> Unit = {
if (javaToolchain.get()) {
environment("JAVA_HOME", common.javaSupport.homePath)
}
}

fun spec(options: ExecSpec.() -> Unit) {
this.specOptions = options
Expand Down

0 comments on commit cacb111

Please sign in to comment.