| /******************************************************************************** |
| * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| ********************************************************************************/ |
| |
| plugins { |
| id 'war' |
| id 'maven-publish' |
| id 'eclipse' |
| id 'jacoco' |
| id "org.sonarqube" version "2.5" |
| id "io.swagger.core.v3.swagger-gradle-plugin" version "2.2.15" |
| } |
| |
| description = 'MDM Nucleus' |
| |
| subprojects { |
| configurations.all { |
| resolutionStrategy.dependencySubstitution { |
| substitute module("de.rechner:openatfx") using project(":api:atfxadapter:openatfx") |
| } |
| } |
| |
| group = rootProject.group |
| version = rootProject.version |
| |
| apply plugin: 'eclipse' |
| apply plugin: 'java-library' |
| apply plugin: 'maven-publish' |
| apply plugin: 'jacoco' |
| |
| dependencies { |
| compileOnly 'org.slf4j:slf4j-api:1.7.25' |
| compileOnly 'javax:javaee-api:7.0' |
| implementation 'io.swagger.core.v3:swagger-annotations:2.2.15' |
| implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.2' |
| runtimeOnly 'ch.qos.logback:logback-classic:1.2.3' |
| |
| testImplementation 'junit:junit:4.12' |
| testImplementation 'org.assertj:assertj-core:3.6.2' |
| testImplementation 'org.mockito:mockito-core:2.13.0' |
| testImplementation 'javax:javaee-api:7.0' |
| } |
| |
| java { |
| withSourcesJar() |
| manifest { |
| attributes( |
| 'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()), |
| 'Build-Revision' : versioning.info.commit, |
| ) |
| } |
| } |
| |
| |
| /*task sourcesJar(type: Jar, dependsOn: classes) { |
| classifier = 'sources' |
| from sourceSets.main.allSource |
| }*/ |
| |
| artifacts { |
| archives sourcesJar |
| } |
| } |
| |
| def isHeadless() { |
| return project.hasProperty('headless') && (headless.empty || headless.toBoolean()) |
| } |
| |
| project(":nucleus:webclient") { |
| if (isHeadless()) { |
| println 'Headless build! Webclient will not be included into web archive. To build and include the webclient remove the property headless or set -Pheadless=false.' |
| project.tasks.all { task -> task.enabled = false } |
| } |
| } |
| |
| configurations { |
| runtime { |
| resolutionStrategy.dependencySubstitution { |
| substitute module("de.rechner:openatfx") using project(":api:atfxadapter:openatfx") |
| } |
| exclude group: 'com.sun.mail', module: 'javax.mail' |
| exclude group: 'javax.ws.rs', module: 'javax.ws.rs-api' |
| exclude group: 'javax.activation', module: 'activation' |
| exclude group: 'javax.annotation', module: 'javax.annotation-api' |
| exclude group: 'javax.inject', module: 'javax.inject' |
| exclude group: 'org.glassfish.hk2.external', module: 'javax.inject' |
| exclude group: 'commons-logging', module: 'commons-logging' |
| // exclude guava dependencies |
| exclude group: 'com.google.code.findbugs', module: 'jsr305' |
| exclude group: 'com.google.errorprone', module: 'error_prone_annotations' |
| exclude group: 'com.google.j2objc', module: 'j2objc-annotations' |
| exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations' |
| exclude group: 'org.checkerframework', module: 'checker-compat-qual' |
| } |
| // see: https://github.com/swagger-api/swagger-core/issues/3335 |
| // and: https://stackoverflow.com/questions/58557741/gradle-plugin-uses-a-older-different-version-of-a-java-library-used-in-the-code |
| swagger { |
| extendsFrom runtimeClasspath |
| resolutionStrategy { |
| force 'com.fasterxml.jackson.core:jackson-core:2.13.3' |
| force 'com.fasterxml.jackson.core:jackson-databind:2.13.3' |
| } |
| } |
| } |
| |
| dependencies { |
| implementation project(':nucleus:application') |
| implementation project(':nucleus:apicopy') |
| implementation project(":nucleus:importscheduler") |
| |
| implementation 'io.swagger.core.v3:swagger-annotations:2.2.15' |
| implementation 'org.webjars:swagger-ui:3.23.0' |
| // adapters |
| runtimeOnly project(':api:atfxadapter') |
| runtimeOnly project(":api:odsadapter") |
| runtimeOnly project(":api:csvadapter") |
| |
| if (!isHeadless()) { |
| runtimeOnly project(':nucleus:webclient') |
| } |
| } |
| |
| |
| resolve { |
| outputPath = file('build/openapi') |
| outputFileName = 'openapi' |
| outputFormat = 'JSONANDYAML' |
| prettyPrint = 'TRUE' |
| classpath = sourceSets.main.output + configurations.swagger |
| resourcePackages = ['org.eclipse.mdm'] |
| openApiFile = file('src/main/openapi/openApiFile.json') |
| } |
| |
| tasks.war.dependsOn("resolve") |
| |
| task collectConfiguration() { |
| doLast { |
| subprojects.each { subproject -> |
| copy { |
| from "${project.projectDir}/${subproject.name}/src/main/configuration/" |
| into "${project.projectDir}/build/tmp/openmdm_application/configuration/org.eclipse.mdm.${subproject.name}" |
| } |
| } |
| } |
| } |
| |
| task copySchema(dependsOn: ':nucleus:preferences:generateSchema') { |
| doLast { |
| copy { |
| from "${project.projectDir}/preferences/build/generated-schema/" |
| into "${project.projectDir}/build/tmp/openmdm_application/schema/org.eclipse.mdm.preferences" |
| } |
| |
| copy { |
| from "${project.projectDir}/preferences/src/main/sql/" |
| into "${project.projectDir}/build/tmp/openmdm_application/schema/update" |
| } |
| } |
| } |
| |
| task distribute(type: Zip) { |
| archiveFileName = "openMDM_application-${version}.zip" |
| |
| from "../LICENSE.txt" |
| from "../NOTICE.txt" |
| from "../CONTRIBUTING.md" |
| from "../README.md" |
| from "../SECURITY.md" |
| from "../release_notes.md" |
| |
| from "../doc/GettingStarted_mdmbl.pdf" |
| from "../doc/Installation Guide for the openMDM5 Application.pdf" |
| |
| from "${project.projectDir}/build/tmp/openmdm_application" |
| from "${project.projectDir}/build/libs/" |
| } |
| distribute.dependsOn(collectConfiguration) |
| distribute.dependsOn(copySchema) |
| |
| war { |
| manifest { |
| attributes( |
| 'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()), |
| 'Build-Revision' : versioning.info.commit, |
| ) |
| } |
| |
| archiveBaseName = 'org.eclipse.mdm.nucleus' |
| |
| from ('application/build/node/dist') { |
| include('**/*') |
| } |
| from ("${project.projectDir}/build/openapi/") { |
| include('**/*') |
| filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [VERSION: version]) |
| } |
| from ("application/src/main/webapp/") { |
| include('**/*') |
| } |
| |
| |
| webXml = file('application/src/main/webconfig/web.xml') |
| webInf {from 'application/src/main/webconfig/glassfish-web.xml'} |
| |
| metaInf { from '../NOTICE.txt' } |
| metaInf { from '../LICENSE.txt' } |
| metaInf { from '../CONTRIBUTING.md' } |
| metaInf { from '../SECURITY.md' } |
| } |
| |
| war.finalizedBy(distribute) |
| |
| jacoco { |
| toolVersion = "0.7.6.201602180812" |
| reportsDirectory = file("${project.buildDir}/jacoco/test.exec") |
| } |
| |
| sonarqube { |
| properties { |
| property "sonar.java.coveragePlugin", "jacoco" |
| property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec" |
| } |
| } |
| tasks["sonarqube"].dependsOn "org.eclipse.mdm.application:map_tslint" |