-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
39 lines (32 loc) · 749 Bytes
/
build.gradle
File metadata and controls
39 lines (32 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
plugins {
id 'java'
}
ext {
modDir = file("$buildDir/mod")
java11 = System.getenv('JAVA_HOME')
}
repositories {
jcenter()
}
dependencies {
testImplementation 'junit:junit:4.12'
}
jar {
//noinspection GroovyAssignabilityCheck
manifest {
attributes('Main-Class': 'com.example.App')
}
}
task prepareModDir {
doLast {
if (!modDir.exists()) {
modDir.mkdirs()
}
}
}
task showJavaVersion(type: Exec) {
commandLine "$java11/bin/java", '-version'
}
task modJar(type: Exec, dependsOn: [compileJava, 'prepareModDir']) {
commandLine "$java11/bin/jar", '-c', '-f', "$modDir/${project.name}.jar", '--main-class', 'com.example.App', '-C', compileJava.destinationDir, '.'
}