|
1 | 1 | plugins {
|
| 2 | + id 'com.github.johnrengelman.shadow' version '6.1.0' |
2 | 3 | id 'java'
|
3 | 4 | }
|
4 | 5 |
|
| 6 | +// See settings.gradle for the project's name |
| 7 | +// This is often your domain name (reversed.) |
5 | 8 | group 'com.yourorganization'
|
| 9 | +// The version of this project. SNAPSHOT means "we're still working on it" |
6 | 10 | version '1.0-SNAPSHOT'
|
7 | 11 |
|
| 12 | +// Tell Gradle we want to use Java 8 |
| 13 | +sourceCompatibility = 1.8 |
| 14 | +targetCompatibility = 1.8 |
| 15 | + |
| 16 | +// Resolve dependencies and plugins using maven central repository. |
8 | 17 | repositories {
|
9 | 18 | mavenCentral()
|
10 | 19 | }
|
11 | 20 |
|
| 21 | +// Gradle dependencies can also sourced from maven central, using the same coordinates (group/name/version). |
12 | 22 | dependencies {
|
13 | 23 | implementation group: 'com.github.javaparser', name: 'javaparser-core', version: '3.15.21'
|
14 | 24 | testCompile group: 'junit', name: 'junit', version: '4.12'
|
15 | 25 | }
|
| 26 | + |
| 27 | + |
| 28 | +// Create a single jar, including all dependencies -- Output to /build/libs/ |
| 29 | +// Documentation available at https://github.com/johnrengelman/shadow |
| 30 | +// run this using: gradle shadowJar |
| 31 | +shadowJar { |
| 32 | + archiveBaseName.set(project.name + '-shadow') |
| 33 | + archiveClassifier.set('beta') |
| 34 | + archiveVersion.set(project.version) |
| 35 | + |
| 36 | + manifest { |
| 37 | + inheritFrom project.tasks.jar.manifest |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | + |
| 42 | +// Default jar settings |
| 43 | +// (note that jar won't include dependencies - either add them to the class path, or bulid a shadow / fat jar) |
| 44 | +// run this using: gradle jar |
| 45 | +jar { |
| 46 | + manifest { |
| 47 | + attributes 'Implementation-Title': 'JavaParser Gradle Jar Example', |
| 48 | + 'Implementation-Version': version, |
| 49 | + 'Main-Class': 'com.yourorganization.maven_sample.LogicPositivizer' |
| 50 | + } |
| 51 | + |
| 52 | + from { |
| 53 | + configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } |
| 54 | + } |
| 55 | +} |
0 commit comments