-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
54 lines (42 loc) · 1.26 KB
/
build.gradle
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import groovy.xml.XmlParser
plugins {
id 'java'
}
repositories {
mavenCentral()
}
defaultTasks("dist")
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
// Add Log4j core and API as dependencies (update version as needed)
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
implementation 'org.apache.logging.log4j:log4j-api:2.24.1'
}
// Task to copy dependencies to the lib directory
tasks.register('copyDependencies', Copy) {
from configurations.runtimeClasspath
into "build/libs"
}
tasks.register("dist", Zip) {
dependsOn("copyDependencies", "build")
from("build/libs") {
include("*.jar")
}
String pluginVersion
if (project.hasProperty('pluginVersion')) {
pluginVersion = project.getProperty('pluginVersion')
} else {
def pluginNode = new XmlParser().parse(new File('src/main/zip/plugin.xml'))
pluginVersion = "${pluginNode.header.identifier.@version[0]}.dev"
}
from("src/main/zip") {
filter {
it.replace("@RELEASE_VERSION@", "$pluginVersion")
}
}
destinationDirectory.set(file("build/distributions"))
archiveFileName = "${rootProject.name}-${pluginVersion}.zip"
}