|
1 | | -// gradle 4.3 |
| 1 | +/* |
| 2 | + * This file was generated by the Gradle 'init' task. |
| 3 | + * |
| 4 | + * This generated file contains a sample Java Library project to get you started. |
| 5 | + * For more details take a look at the Java Libraries chapter in the Gradle |
| 6 | + * User Manual available at https://docs.gradle.org/7.5/userguide/java_library_plugin.html |
| 7 | + */ |
| 8 | + |
| 9 | +// |
| 10 | +plugins { |
| 11 | + // Apply the java-library plugin to add support for Java Library |
| 12 | + id 'java-library' |
| 13 | + id 'java' |
| 14 | + id 'eclipse' |
| 15 | + id 'application' |
| 16 | +// id 'pmd' |
| 17 | +// id 'checkstyle' |
| 18 | + id 'com.github.johnrengelman.shadow' version '7.1.2' |
| 19 | +} |
2 | 20 |
|
3 | | -apply plugin: 'java' |
4 | | -//apply plugin: 'checkstyle' |
5 | | -//apply plugin: 'findbugs' |
6 | | -//apply plugin: 'pmd' |
7 | | -apply plugin: 'application' |
8 | | -apply plugin: 'eclipse' |
| 21 | +mainClassName = "scriptmanager.main.ScriptManager" |
| 22 | +version = 'v0.14-dev' |
9 | 23 |
|
10 | | -sourceSets.main.java.srcDirs = ['src'] |
11 | | -mainClassName = "main.ScriptManager" |
12 | | -version = 'v0.14' |
13 | 24 | sourceCompatibility = 1.8 |
14 | 25 | targetCompatibility = 1.8 |
15 | 26 |
|
16 | | -// Gradle builds for dev |
17 | | -jar { |
18 | | - from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } |
19 | | - |
20 | | - baseName = "ScriptManager" |
21 | | - |
22 | | - manifest { |
23 | | - attributes 'ScriptManager-Title': baseName, |
24 | | - 'ScriptManager-Version': version, |
25 | | - 'Main-Class': mainClassName |
26 | | - } |
27 | | -} |
28 | | - |
29 | | -// Create a single JAR with all dependencies bundles - for production deployment |
30 | | -task fatJar(type: Jar) { |
31 | | - exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' |
32 | | - |
33 | | - manifest { |
34 | | - attributes 'ScriptManager-Title': 'Gradle jar of ScriptManager', |
35 | | - 'ScriptManager-Version': version, |
36 | | - 'Main-Class': mainClassName |
37 | | - } |
38 | | - |
39 | | - baseName = 'ScriptManager' + version |
40 | | - from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } |
41 | | - with jar |
42 | | -} |
43 | | - |
44 | 27 | // Get dependencies from Maven central repository |
45 | 28 | repositories { |
| 29 | + // Use jcenter for resolving dependencies. |
| 30 | + //jcenter() |
| 31 | + // You can declare any Maven/Ivy/file repository here. |
46 | 32 | mavenCentral() |
47 | 33 | } |
48 | 34 |
|
49 | 35 | // Declare the dependencies for your production and test code |
50 | 36 | dependencies { |
51 | | - compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.13' |
52 | | - // https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api |
53 | | - compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1' |
54 | | - // https://mvnrepository.com/artifact/info.picocli/picocli #CommandLineInterface Parsing Args |
55 | | - compile group: 'info.picocli', name: 'picocli', version: '4.2.0' |
56 | | - compile group: 'org.jfree', name: 'jfreechart', version: '1.5.3' |
57 | | - compile group: 'org.jfree', name: 'jfreesvg', version: '3.4.2' |
58 | | - testCompile group: 'junit', name: 'junit', version: '4.12' |
59 | | - compile fileTree(dir: 'lib', include: ['*.jar']) |
60 | | - } |
| 37 | + implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.13' |
| 38 | + // https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api |
| 39 | + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1' |
| 40 | + // https://mvnrepository.com/artifact/info.picocli/picocli #CommandLineInterface Parsing Args |
| 41 | + implementation group: 'info.picocli', name: 'picocli', version: '4.2.0' |
| 42 | + implementation group: 'org.jfree', name: 'jfreechart', version: '1.5.3' |
| 43 | + implementation group: 'org.jfree', name: 'jfreesvg', version: '3.4.2' |
| 44 | + implementation fileTree(dir: 'lib', include: ['*.jar']) |
| 45 | +} |
| 46 | + |
| 47 | +// Declare dependencies explicitly (for Gradle 7.X with Shadow) |
| 48 | +tasks.shadowJar.dependsOn ':distTar' |
| 49 | +tasks.shadowJar.dependsOn ':distZip' |
| 50 | + |
| 51 | +// Build fat jar executable with all dependencies bundled together |
| 52 | +shadowJar { |
| 53 | + // Configure JAR file name |
| 54 | + archiveBaseName.set('ScriptManager') |
| 55 | + archiveClassifier.set('') |
| 56 | + archiveVersion.set(version) |
61 | 57 |
|
62 | | -uploadArchives { |
63 | | - repositories { |
64 | | - flatDir { |
65 | | - dirs 'repos' |
66 | | - } |
67 | | - } |
| 58 | + // Reduce fat jar to only include dependencies used |
| 59 | + minimize() |
68 | 60 | } |
0 commit comments