-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
49 lines (42 loc) · 1.06 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
// Apply plugins
plugins {
id 'java'
id 'application'
id 'com.diffplug.spotless' version '6.25.0'
}
// Define main class
application {
mainClass = 'com.mohanvamsi06.FileEncryptor.main.Main'
}
// Define repositories
repositories {
mavenCentral()
}
// Define dependencies
dependencies {
implementation 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.12'
}
// Create a fat JAR (includes dependencies)
tasks.register('fatJar', Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set('all')
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes 'Main-Class': application.mainClass.get()
}
}
//Spotless for Java
spotless {
java {
target 'src/**/*.java' // Specify which files to format
googleJavaFormat() // Use Google Java Format
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}