69 lines
2.0 KiB
Groovy
69 lines
2.0 KiB
Groovy
plugins {
|
|
id 'java'
|
|
|
|
// [MODULAR]
|
|
id 'org.javamodularity.moduleplugin' version '1.8.15' // [Modularity] - https://github.com/java9-modularity/gradle-modules-plugin
|
|
|
|
id 'maven-publish' // [Maven] Publish - https://docs.gradle.org/current/userguide/publishing_maven.html
|
|
}
|
|
|
|
group = 'fr.doap.jdb'
|
|
version = '1.0-SNAPSHOT'
|
|
|
|
repositories {
|
|
maven { url = 'https://maven.doap.fr/repository/maven-all/' }
|
|
}
|
|
|
|
ext {
|
|
junitVersion = '5.10.2'
|
|
h2Version = '2.2.224'
|
|
slf4jVersion = '2.0.13'
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
// Don't cache SNAPSHOT dependencies
|
|
configurations.configureEach {
|
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
}
|
|
|
|
dependencies {
|
|
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
|
|
|
testImplementation platform("org.junit:junit-bom:$junitVersion")
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
|
|
|
testImplementation "com.h2database:h2:$h2Version"
|
|
testImplementation "org.slf4j:slf4j-simple:$slf4jVersion"
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
// [Maven Publish] - https://docs.gradle.org/current/userguide/publishing_maven.html
|
|
publishing {
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from components.java
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
if ((System.getenv('MAVEN_USERNAME') == null) || (System.getenv('MAVEN_PASSWORD') == null)) {
|
|
throw new GradleException("You must define the Windows Environment variables MAVEN_USERNAME and MAVEN_PASSWORD to publish to the repository")
|
|
}
|
|
|
|
def releasesRepoUrl = "https://maven.doap.fr/repository/maven-releases/"
|
|
def snapshotsRepoUrl = "https://maven.doap.fr/repository/maven-snapshots/"
|
|
url = version.endsWith('-SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
|
|
|
credentials {
|
|
username System.getenv('MAVEN_USERNAME')
|
|
password System.getenv('MAVEN_PASSWORD')
|
|
}
|
|
}
|
|
}
|
|
} |