Files
jabba/build.gradle
2026-05-01 13:38:37 -05:00

174 lines
5.2 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 = '3.0.0-SNAPSHOT'
application{
mainClass=(group+'.'+name+'.JettyApp')
}
java{
// Updated to Java 21 for modern features and better performance
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-parameters'
}
dependencies {
def jettyVersion="12.0.15"
def bstoreVersion="1.0.0-SNAPSHOT"
implementation "org.eclipse.jetty:jetty-server:${jettyVersion}"
implementation "org.eclipse.jetty.http2:jetty-http2-server:${jettyVersion}"
implementation "org.eclipse.jetty.ee10:jetty-ee10-servlet:${jettyVersion}"
implementation "org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server:${jettyVersion}"
implementation "jakarta.servlet:jakarta.servlet-api:6.0.0"
implementation "org.slf4j:slf4j-jdk14:2.0.16"
//implementation "org.slf4j:slf4j-simple:2.0.16"
//implementation 'com.hubspot.jinjava:jinjava:2.5.10'
implementation 'com.github.jknack:handlebars:4.4.0'
implementation "com.reliancy:bstore-j:${bstoreVersion}"
testImplementation "junit:junit:4.13.2"
testImplementation "org.eclipse.jetty.websocket:jetty-websocket-jetty-client:${jettyVersion}"
}
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/")
}
}
}
}
}
// Task to run DemoApp demonstration application
task runDemo(type: JavaExec, dependsOn: testClasses) {
group = 'application'
description = 'Run the DemoApp demonstration application'
classpath = sourceSets.test.runtimeClasspath
mainClass = 'com.reliancy.jabba.DemoApp'
args = project.hasProperty('appArgs') ? project.appArgs.split('\\s+') : []
workingDir = projectDir
standardInput = System.in
}