forked from odpi/egeria
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request odpi#7007 from planetf1/gradle40
Gradle: create maven artifacts
- Loading branch information
Showing
3 changed files
with
177 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,31 +4,19 @@ | |
*/ | ||
|
||
|
||
/* | ||
* Used for Build scripts/plugins only | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
/* | ||
* Plugins for this parent module only - so just high level project related | ||
*/ | ||
|
||
plugins { | ||
id "io.freefair.lombok" version "6.5.1" | ||
id "io.freefair.aggregate-javadoc" version "6.5.1" | ||
// Checks for unnecessary dependencies | ||
id 'com.autonomousapps.dependency-analysis' version "1.13.1" | ||
// helps resolve log implementation clashes | ||
id 'dev.jacomet.logging-capabilities' version "0.10.0" | ||
// This plugin helps resolve jakarta/javax dev.jacomet.logging-capabilities | ||
id 'de.jjohannes.java-ecosystem-capabilities' version "0.5" | ||
} | ||
|
||
id "io.freefair.lombok" version "6.5.1" | ||
id "io.freefair.aggregate-javadoc" version "6.5.1" | ||
// Checks for unnecessary dependencies | ||
id 'com.autonomousapps.dependency-analysis' version "1.13.1" | ||
// helps resolve log implementation clashes | ||
id 'dev.jacomet.logging-capabilities' version "0.10.0" | ||
// This plugin helps resolve jakarta/javax dev.jacomet.logging-capabilities | ||
id 'de.jjohannes.java-ecosystem-capabilities' version "0.6" | ||
} | ||
|
||
|
||
/* | ||
|
@@ -43,33 +31,34 @@ allprojects { | |
// Mostly java, so default to this for now | ||
apply plugin: 'java' | ||
apply plugin: 'jacoco' | ||
//apply plugin: 'io.freefair.lombok' | ||
apply plugin: 'de.jjohannes.java-ecosystem-capabilities' | ||
apply plugin: 'dev.jacomet.logging-capabilities' | ||
|
||
// As we've migrated from maven - we'll assume all submodules publish directly to maven | ||
apply plugin: 'maven-publish' | ||
|
||
// Only use maven central | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
url "https://maven.atlassian.com/3rdparty" | ||
} | ||
} | ||
|
||
// ensures we pick up the very latest snapshots when built | ||
configurations.all { | ||
// check for updates every build | ||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | ||
} | ||
|
||
/* | ||
* Dependency Management - to fix versions. Pick up maven build settings for now | ||
*/ | ||
|
||
// Assign variables for any constraints | ||
|
||
ext { | ||
antlrVersion = '3.5.3' | ||
ST4Version = '4.3.4' | ||
avroVersion = '1.11.1' | ||
classgraphVersion = '4.8.149' | ||
classmateVersion = '1.5.1' | ||
collections4Version='4.4' | ||
collections4Version = '4.4' | ||
commonscodecVersion = '1.15' | ||
commonsconfiguration2Version = '2.8.0' | ||
commonsconfigurationVersion = '1.10' | ||
|
@@ -92,7 +81,7 @@ allprojects { | |
jacksonaslVersion = '1.9.14-atlassian-6' | ||
jakartaannotationVersion = '1.3.5' | ||
jakartapersistenceVersion = '3.1.0' | ||
jakartavalidationVersion = '3.0.2' | ||
jakartavalidationVersion = '3.0.2' | ||
janusVersion = '0.6.2' | ||
javassistVersion = '3.29.0-GA' | ||
jaxbVersion = '2.3.1' | ||
|
@@ -104,7 +93,7 @@ allprojects { | |
junitplatformVersion = '1.8.2' | ||
jwtVersion = '0.9.1' | ||
kafkaVersion = '3.3.1' | ||
lang3Version='3.12.0' | ||
lang3Version = '3.12.0' | ||
logbackVersion = '1.2.11' | ||
lettuceVersion = '6.2.0.RELEASE' | ||
luceneVersion = '8.11.1' | ||
|
@@ -205,8 +194,10 @@ allprojects { | |
implementation("org.apache.tinkerpop:gremlin-core:${gremlinVersion}") | ||
implementation("org.apache.tinkerpop:gremlin-groovy:${gremlinVersion}") | ||
implementation("org.apache.tinkerpop:gremlin-shaded:${gremlinVersion}") | ||
implementation("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}") //TODO May need to exclude tomcat-annotations-api | ||
implementation("org.apache.tomcat:tomcat-coyote:${tomcatVersion}") //TODO May need to exclude tomcat-annotations-api | ||
implementation("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}") | ||
//TODO May need to exclude tomcat-annotations-api | ||
implementation("org.apache.tomcat:tomcat-coyote:${tomcatVersion}") | ||
//TODO May need to exclude tomcat-annotations-api | ||
implementation("org.codehaus.groovy:groovy:${groovyVersion}") | ||
implementation("org.codehaus.groovy:groovy-cli-picocli:${groovyVersion}") | ||
implementation("org.codehaus.groovy:groovy-console:${groovyVersion}") | ||
|
@@ -253,8 +244,8 @@ allprojects { | |
implementation("org.springframework:spring-core:${springwebVersion}") | ||
implementation("org.springframework.ldap:ldap-core:${springldapVersion}") | ||
implementation("javax.servlet:javax.servlet-api:${servletVersion}") | ||
implementation("commons-configuration:commons-configuration:${commonsconfigurationVersion}") | ||
implementation("org.apache.commons:commons-configuration2:${commonsconfiguration2Version}") | ||
implementation("commons-configuration:commons-configuration:${commonsconfigurationVersion}") | ||
implementation("org.apache.commons:commons-configuration2:${commonsconfiguration2Version}") | ||
implementation("org.hibernate:hibernate-validator:${hibernatevalidatorVersion}") | ||
implementation("org.apache.thrift:libthrift:${thriftVersion}") | ||
implementation("org.apache.cassandra:cassandra-all:${cassandraVersion}") | ||
|
@@ -282,7 +273,7 @@ allprojects { | |
runtimeOnly("org.xerial.snappy:snappy-java:${snappyVersion}") | ||
runtimeOnly("org.janusgraph:janusgraph-es:${janusVersion}") | ||
runtimeOnly("org.xerial.snappy:snappy-java:${snappyVersion}") | ||
runtimeOnly("javax.servlet:javax.servlet-api:${servletVersion}") | ||
runtimeOnly("javax.servlet:javax.servlet-api:${servletVersion}") | ||
testImplementation("junit:junit:${junitVersion}") | ||
testImplementation("org.glassfish:javax.json:${glassfishVersion}") | ||
testImplementation("org.junit.jupiter:junit-jupiter:${junitjupiterVersion}") | ||
|
@@ -300,101 +291,178 @@ allprojects { | |
} | ||
} | ||
|
||
/* | ||
* Java related configuration | ||
*/ | ||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
tasks.withType(JavaCompile) { | ||
options.release = 11 | ||
options.encoding = 'UTF-8' | ||
options.incremental = true | ||
options.failOnError = true | ||
options.compilerArgs << "-Xlint:all" | ||
} | ||
|
||
// javadoc | ||
javadoc { | ||
options.addBooleanOption('html5', true) | ||
} | ||
|
||
// code coverage | ||
jacoco { | ||
toolVersion = "0.8.8" | ||
} | ||
|
||
// Allow for tests to be run in all projects | ||
// Testing | ||
test { | ||
useJUnitPlatform() | ||
useJUnitPlatform { | ||
includeEngines 'junit-jupiter' | ||
} | ||
dependencies { | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0' | ||
} | ||
|
||
testLogging { | ||
events "passed", "skipped", "failed" | ||
} | ||
|
||
reports { | ||
html.required = true | ||
} | ||
} | ||
dependencies { | ||
testImplementation("junit:junit") | ||
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-engine' | ||
/* | ||
* Publishing of maven artifacts -- and signing (only for CI) | ||
*/ | ||
if (System.getenv("CI")) { | ||
apply plugin: 'signing' | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
from(components.java) | ||
connector(MavenPublication) { | ||
from components.java | ||
pom { | ||
url = 'http://egeria.odpi.org' | ||
licenses { | ||
// Code | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
// Docs | ||
license { | ||
name = 'Creative Commons Attribution 4.0 International (CC BY 4.0)' | ||
url = 'https://creativecommons.org/licenses/by/4.0' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'planetf1' | ||
name = 'Nigel Jones' | ||
email = '[email protected]' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:git://github.com/odpi/egeria.git' | ||
developerConnection = 'scm:git:ssh://github.com/odpi/egeria/egeria.git' | ||
url = 'http://github.com/odpi/egeria' | ||
} | ||
} | ||
// Override the project name & description for the pom based on properties set in the child build.gradle (hard to default & required for maven central) | ||
pom.withXml { | ||
asNode().appendNode('name', "${project.name}") | ||
asNode().appendNode('description', "${project.description}") | ||
} | ||
} | ||
} | ||
// Release versions get pushed to staging area on maven central, snapshots to snapshot repo | ||
// Secrets for credentials | ||
if (System.getenv("CI")) { | ||
repositories { | ||
maven { | ||
name = 'OSSRH' | ||
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' | ||
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots' | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
// User token (under profile) on oss.sonatype.org | ||
credentials { | ||
username = System.getenv("OSSRH_USERNAME") | ||
password = System.getenv("OSSRH_TOKEN") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
sourceCompatibility = "11" | ||
targetCompatibility = "11" | ||
options.compilerArgs << "-Xlint:all" | ||
} | ||
|
||
|
||
|
||
// Tasks to help in finding dependency chains | ||
/* | ||
* Additional useful tasks | ||
*/ | ||
task printAllDependencies(type: DependencyReportTask) {} | ||
task printSubDependencies(type: DependencyReportTask) {} | ||
task findDependency(type: DependencyInsightReportTask) {} | ||
|
||
// Whilst all modules have their own javadoc, we only build | ||
// an aggregate for the client and API modules plus the REST calls | ||
javadoc { | ||
include ( "**/api/*.java" ) | ||
include ( "**/client/*.java" ) | ||
include ( "**/clients/*.java" ) | ||
include ( "**/properties/*.java" ) | ||
include ( "**/metadataelements/*.java" ) | ||
include ( "**/metadataelement/*.java" ) | ||
include ( "**/events/*.java" ) | ||
include ( "**/rest/*.java" ) | ||
include ( "**/exceptions/*.java" ) | ||
include ( "**/beans/*.java" ) | ||
include ( "**/ffdc/*.java" ) | ||
include ( "**/configuration/*.java" ) | ||
include ( "**/configuration/registration/*.java" ) | ||
include ( "**/store/*.java" ) | ||
include ( "**/connectors/*.java" ) | ||
include ( "**/adminservices/*.java" ) | ||
include ( "**/connector/*.java" ) | ||
include ( "**/frameworks/*.java" ) | ||
include ( "**/context/*.java" ) | ||
include ( "**/contextmanager/*.java" ) | ||
include ( "**/graph/*.java" ) | ||
include ( "**/model/*.java" ) | ||
include ( "**/auditlog/*.java" ) | ||
include ( "**/omrstopic/*.java" ) | ||
include ( "**/openmetadatatopic/*.java" ) | ||
include ( "**/archivestore/*.java" ) | ||
include ( "**/auditlogstore/*.java" ) | ||
include ( "**/cohortregistrystore/*.java" ) | ||
include ( "**/repositoryconnector/*.java" ) | ||
include ( "**/repositoryeventmapper/*.java" ) | ||
include ( "**/metadatacollectionstore/*.java" ) | ||
include ( "**/metadatacollectionstore/properties/instances/*.java" ) | ||
include ( "**/metadatacollectionstore/properties/typedefs/*.java" ) | ||
include ( "**/metadatacollectionstore/properties/search/*.java" ) | ||
include ( "**/metadatacollectionstore/utilities/*.java" ) | ||
include ( "**/archiveutilities/*.java" ) | ||
include ( "**/metadatasecurity/*.java" ) | ||
include ( "**/spring/*.java" ) | ||
include ( "**/frameworks/**/*.java" ) | ||
} | ||
} // end of allProjects | ||
|
||
// Whilst all modules have their own javadoc, we only build | ||
// an aggregate for the client and API modules plus the REST calls | ||
javadoc { | ||
include("**/api/*.java") | ||
include("**/client/*.java") | ||
include("**/clients/*.java") | ||
include("**/properties/*.java") | ||
include("**/metadataelements/*.java") | ||
include("**/metadataelement/*.java") | ||
include("**/events/*.java") | ||
include("**/rest/*.java") | ||
include("**/exceptions/*.java") | ||
include("**/beans/*.java") | ||
include("**/ffdc/*.java") | ||
include("**/configuration/*.java") | ||
include("**/configuration/registration/*.java") | ||
include("**/store/*.java") | ||
include("**/connectors/*.java") | ||
include("**/adminservices/*.java") | ||
include("**/connector/*.java") | ||
include("**/frameworks/*.java") | ||
include("**/context/*.java") | ||
include("**/contextmanager/*.java") | ||
include("**/graph/*.java") | ||
include("**/model/*.java") | ||
include("**/auditlog/*.java") | ||
include("**/omrstopic/*.java") | ||
include("**/openmetadatatopic/*.java") | ||
include("**/archivestore/*.java") | ||
include("**/auditlogstore/*.java") | ||
include("**/cohortregistrystore/*.java") | ||
include("**/repositoryconnector/*.java") | ||
include("**/repositoryeventmapper/*.java") | ||
include("**/metadatacollectionstore/*.java") | ||
include("**/metadatacollectionstore/properties/instances/*.java") | ||
include("**/metadatacollectionstore/properties/typedefs/*.java") | ||
include("**/metadatacollectionstore/properties/search/*.java") | ||
include("**/metadatacollectionstore/utilities/*.java") | ||
include("**/archiveutilities/*.java") | ||
include("**/metadatasecurity/*.java") | ||
include("**/spring/*.java") | ||
include("**/frameworks/**/*.java") | ||
} | ||
|
||
|
||
/* | ||
* Configuration for sub projects only | ||
*/ | ||
|
||
subprojects { | ||
// All tasks currently will run under allProjects - which includes root. | ||
} | ||
|
||
// Aggregation task | ||
|
||
/* | ||
* Additional aggregate tasks run only at parent | ||
*/ | ||
|
||
// Jacoco reporting -- from gradle docs | ||
task codeCoverageReport(type: JacocoReport) { | ||
|
@@ -438,5 +506,5 @@ dependencyAnalysis { | |
} | ||
} | ||
|
||
// Always run dependency check | ||
// Always run dependency check for every regular build | ||
build.dependsOn("buildHealth") |
Oops, something went wrong.