Skip to content

Commit a947b1e

Browse files
committed
comments copied from the maven sample project, and a gradle plugin to generate a fat jar has been configured and added
1 parent ec06c83 commit a947b1e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

build.gradle

+40
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,55 @@
11
plugins {
2+
id 'com.github.johnrengelman.shadow' version '6.1.0'
23
id 'java'
34
}
45

6+
// See settings.gradle for the project's name
7+
// This is often your domain name (reversed.)
58
group 'com.yourorganization'
9+
// The version of this project. SNAPSHOT means "we're still working on it"
610
version '1.0-SNAPSHOT'
711

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.
817
repositories {
918
mavenCentral()
1019
}
1120

21+
// Gradle dependencies can also sourced from maven central, using the same coordinates (group/name/version).
1222
dependencies {
1323
implementation group: 'com.github.javaparser', name: 'javaparser-core', version: '3.15.21'
1424
testCompile group: 'junit', name: 'junit', version: '4.12'
1525
}
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+
}

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
// The name of this project (actually, the name of the artifact, which is the thing that this project produces. A jar in this case.)
12
rootProject.name = 'javaparser-gradle-sample'
23

0 commit comments

Comments
 (0)