Skip to content

Instantly share code, notes, and snippets.

@SanthoshBabuMR
Last active October 4, 2020 04:04
Show Gist options
  • Save SanthoshBabuMR/1ecbdeaa7f8da6c164d20f47c5f647fa to your computer and use it in GitHub Desktop.
Save SanthoshBabuMR/1ecbdeaa7f8da6c164d20f47c5f647fa to your computer and use it in GitHub Desktop.
build.gradle
apply plugin: 'java'
version = 0.1
sourceCompatibility = 1.8
// location to download the depenedencies
repositories {
mavenCentral()
}
// what dependencies to download based on configuration (compile, providedCompile, runtime)
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'
providedCompile 'javax.servlet:servlet-api:2.5'
runtime 'javax.servlet:jstl:1.1.2'
}
// setup wrapper - run only once
task wrapper(type: Wrapper) {
gradleVersion = '6.2'
}
// map src/main/java and src/test/java
sourceSets {
main {
java {
srcDirs = ['src']
}
}
test {
java {
srcDirs = ['test']
}
}
}
// change `build` dir to `out`
buildDir = 'out'
// configure 'main' class
jar {
manifest {
attributes 'Main-Class': 'com.myorg.mymain'
}
}
// For Web Application, use `webfiles` dir instead of `webapp` dir
webAppDirName = 'webfiles'
// pull contents from `static` folder into war (front end assets- jsp,css,js,html)
war {
from 'static'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment