156 lines
4.4 KiB
Groovy
156 lines
4.4 KiB
Groovy
/**
|
|
Local repostories:
|
|
Unix - ~/.m2
|
|
Windows - C:\Users\<username>\.m2
|
|
For example - /Users/alex/.m2/repository/<library_path>/<version>/<name>.<extension>
|
|
*/
|
|
apply plugin: 'java'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'application'
|
|
apply plugin: 'eclipse'
|
|
apply from: 'extra.gradle'
|
|
|
|
project.buildDir = 'target'
|
|
group='com.reliancy'
|
|
version = '0.3-SNAPSHOT'
|
|
application{
|
|
mainClass=(group+'.'+name+'.JettyApp')
|
|
}
|
|
java{
|
|
// make our library a bit more compatible (jetty forced 11 else it would have been 1.8)
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
|
|
dependencies {
|
|
def jettyVersion="11.0.18"
|
|
implementation "org.eclipse.jetty:jetty-server:${jettyVersion}"
|
|
implementation "org.eclipse.jetty.http2:http2-server:${jettyVersion}"
|
|
implementation "org.slf4j:slf4j-jdk14:2.0.10"
|
|
//implementation "org.slf4j:slf4j-simple:2.0.10"
|
|
//implementation 'com.hubspot.jinjava:jinjava:2.5.10'
|
|
implementation 'com.github.jknack:handlebars:4.3.0'
|
|
implementation 'com.h2database:h2:2.1.214'
|
|
implementation 'org.postgresql:postgresql:42.5.0'
|
|
implementation 'com.zaxxer:HikariCP:5.0.0'
|
|
testImplementation "junit:junit:4.12"
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
resources {
|
|
srcDirs "src/main/resources", "src/main/web"
|
|
}
|
|
}
|
|
}
|
|
processResources {
|
|
from (sourceSets.main.java.srcDirs) {
|
|
include '**/*.htm'
|
|
include '**/*.html'
|
|
include '**/*.properties'
|
|
include '**/*.ini'
|
|
include '**/*.json'
|
|
include '**/*.js'
|
|
include '**/*.css'
|
|
include '**/*.txt'
|
|
include '**/*.xml'
|
|
include '**/*.png'
|
|
}
|
|
}
|
|
repositories {
|
|
//mavenLocal()
|
|
//mavenCentral()
|
|
maven{
|
|
url "https://repo.reliancy.com/repository/maven-hub"
|
|
}
|
|
}
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
from components.java
|
|
artifact packageJavadoc
|
|
artifact packageSources
|
|
pom {
|
|
licenses {
|
|
license {
|
|
name = 'GNU Lesser General Public License, Version 3.0'
|
|
url = 'https://www.gnu.org/licenses/lgpl-3.0.txt'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
if (project.version.toUpperCase().endsWith("-SNAPSHOT")) {
|
|
url project.repo_url+"-snapshots"
|
|
} else {
|
|
url project.repo_url+"-releases"
|
|
}
|
|
credentials{
|
|
username project.repo_user
|
|
password project.repo_pwd
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
javadoc {
|
|
source = sourceSets.main.allJava
|
|
//classpath = configurations.compile
|
|
classpath = configurations.compileClasspath
|
|
options
|
|
{
|
|
setMemberLevel JavadocMemberLevel.PUBLIC
|
|
setAuthor true
|
|
links "https://docs.oracle.com/javase/8/docs/api/"
|
|
}
|
|
}
|
|
test {
|
|
environment "DB_URL", project.db_url
|
|
testLogging {
|
|
// Make sure output from
|
|
// standard out or error is shown
|
|
// in Gradle output.
|
|
outputs.upToDateWhen {false}
|
|
//showStandardStreams = true
|
|
exceptionFormat = 'full'
|
|
// Or we use events method:
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
// events 'standard_out', 'standard_error'
|
|
|
|
// Or set property events:
|
|
// events = ['standard_out', 'standard_error']
|
|
|
|
// Instead of string values we can
|
|
// use enum values:
|
|
// events org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT,
|
|
// org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
|
|
}
|
|
}
|
|
jar {
|
|
archiveBaseName = project.name
|
|
archiveVersion = project.version
|
|
manifest {
|
|
attributes "Main-Class": application.mainClass
|
|
attributes "Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
|
|
}
|
|
}
|
|
task copyToLib(type: Copy) {
|
|
//into "${buildDir}/libs" from configurations.runtimeClasspath
|
|
into layout.buildDirectory.dir("libs") from configurations.runtimeClasspath
|
|
}
|
|
build.finalizedBy(copyToLib)
|
|
eclipse{
|
|
classpath {
|
|
defaultOutputDir = file("${relativePath(buildDir)}/bin") ///default
|
|
file.whenMerged { cp ->
|
|
cp.entries.forEach { cpe ->
|
|
if (cpe.kind == 'src' && cpe.hasProperty('output')) {
|
|
cpe.output = cpe.output.replace('bin/', "${relativePath(buildDir)}/classes/java/")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|