Commit 5a2ef014 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

Merge branch 'make_modular' into 'master'

Search reworked as modular Gradle/Spring Boot project

See merge request !17
parents a1a825b8 35c138da
Pipeline #23425 failed with stages
in 1 minute and 17 seconds
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
......@@ -114,3 +114,6 @@ gradle-app.setting
### Gradle Patch ###
**/build/
# Ignore Gradle build output directory
build
......@@ -7,7 +7,7 @@ variables:
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- ./gradlew wrapper --gradle-version=5.6.4 --distribution-type=bin
- ./gradlew wrapper --distribution-type=bin
cache:
paths:
......@@ -15,9 +15,15 @@ cache:
- .gradle/caches
stages:
- test
- build
- deploy
test:
stage: test
script:
- ./gradlew check -x test
build:
stage: build
script: ./gradlew assemble
......
[submodule "src/main/resources/i18n"]
path = src/main/resources/i18n
url = ../webapp-commons-i18n.git
[submodule "src/main/webapp/resources"]
path = src/main/webapp/resources
url = ../search-commons-webresources.git
[submodule "src/main/webapp/WEB-INF/view/jsp/_search-common"]
path = src/main/webapp/WEB-INF/view/jsp/_search-common
url = ../search-commons-views.git
[submodule "src/main/webapp/themes/dariah-theme"]
path = src/main/webapp/themes/dariah-theme
url = ../themes/dariah-theme.git
[submodule "src/main/webapp/themes/mww-theme"]
path = src/main/webapp/themes/mww-theme
url = ../themes/mww-theme.git
[submodule "src/main/webapp/themes/clariah-theme"]
path = src/main/webapp/themes/clariah-theme
url = ../themes/clariah-theme.git
[submodule "src/main/webapp/themes/tutorial-finder-theme"]
path = src/main/webapp/themes/tutorial-finder-theme
url = ../themes/tutorial-finder-theme.git
[submodule "search-ui/src/main/resources/i18n"]
path = search-ui/src/main/resources/i18n
url = https://gitlab.rz.uni-bamberg.de/dariah/webapp-commons-i18n.git
[submodule "search-ui/src/main/webapp/WEB-INF/view/jsp/_search-commons"]
path = search-ui/src/main/webapp/WEB-INF/view/jsp/_search-commons
url = https://gitlab.rz.uni-bamberg.de/dariah/search-commons-views.git
[submodule "search-ui/src/main/webapp/resources"]
path = search-ui/src/main/webapp/resources
url = https://gitlab.rz.uni-bamberg.de/dariah/search-commons-webresources.git
[submodule "search-ui/src/main/webapp/themes/ohd-theme"]
path = search-ui/src/main/webapp/themes/ohd-theme
url = https://gitlab.rz.uni-bamberg.de/dariah/themes/ohd-theme.git
[submodule "search-ui/src/main/webapp/themes/tutorial-finder-theme"]
path = search-ui/src/main/webapp/themes/tutorial-finder-theme
url = https://gitlab.rz.uni-bamberg.de/dariah/themes/tutorial-finder-theme.git
[submodule "search-ui/src/main/webapp/themes/clariah-theme"]
path = search-ui/src/main/webapp/themes/clariah-theme
url = https://gitlab.rz.uni-bamberg.de/dariah/themes/clariah-theme.git
[submodule "search-ui/src/main/webapp/themes/mww-theme"]
path = search-ui/src/main/webapp/themes/mww-theme
url = https://gitlab.rz.uni-bamberg.de/dariah/themes/mww-theme.git
[submodule "search-ui/src/main/webapp/themes/dariah-theme"]
path = search-ui/src/main/webapp/themes/dariah-theme
url = https://gitlab.rz.uni-bamberg.de/dariah/themes/dariah-theme.git
buildscript {
repositories {
//maven { url 'https://repo.spring.io/plugins-snapshot' }
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
//classpath 'io.spring.gradle:dependency-management-plugin'
classpath 'com.netflix.nebula:gradle-ospackage-plugin'
}
}
plugins {
id 'war'
//id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'maven-publish'
id 'eclipse'
id 'nebula.ospackage' version '8.3.0'
}
allprojects {
group = 'eu.dariah.de.minfba'
version = '3.12.0-RELEASE'
description = 'DARIAH-DE Generic Search'
ext {
mavenRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-central/'
releasesRepo = "https://minfba.de.dariah.eu/nexus/repository/minfba-releases/"
snapshotsRepo = "https://minfba.de.dariah.eu/nexus/repository/minfba-snapshots/"
aptRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-apt/'
yumRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-yum/'
repoUser = project.hasProperty('nexususer') ? project.getProperty('nexususer') : '?';
repoPass = project.hasProperty('nexuspass') ? project.getProperty('nexuspass') : ''
}
}
repositories {
mavenLocal()
maven {
url = mavenRepo
}
id 'io.spring.dependency-management' version "1.0.10.RELEASE"
id 'org.springframework.boot' version "2.3.5.RELEASE" apply false
id "nebula.ospackage" version "8.4.1" apply false
}
sourceCompatibility = '1.8'
ext {
searchCommonsVersion = "1.20.2-SNAPSHOT"
springVersion = "4.3.6.RELEASE"
hibernateValidatorVersion = "5.2.2.Final"
tilesVersion = "3.0.5"
slf4jVersion = "1.7.25"
httpComponentsVersion = "4.5.5"
logbackVersion = "1.2.3"
// Filled dynamically by packaging tasks
debFile = ""
rpmFile = ""
}
dependencies {
compile "eu.dariah.de.minfba:search-commons:$searchCommonsVersion"
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-beans:$springVersion"
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework:spring-web:$springVersion"
//compile "org.springframework.security:spring-security-core:4.2.1.RELEASE"
//compile "org.springframework.security:spring-security-web:4.2.1.RELEASE"
//compile "org.springframework.security:spring-security-config:4.2.1.RELEASE"
compile "org.apache.httpcomponents:httpclient:$httpComponentsVersion"
compile "org.apache.tiles:tiles-core:$tilesVersion"
compile "org.apache.tiles:tiles-jsp:$tilesVersion"
compile "org.apache.tiles:tiles-api:$tilesVersion"
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "ch.qos.logback:logback-core:$logbackVersion"
compile "ch.qos.logback:logback-classic:$logbackVersion"
compile "javax.servlet:jstl:1.2"
compile "org.yaml:snakeyaml:1.18"
runtime "org.slf4j:jcl-over-slf4j:$slf4jVersion"
runtime "org.slf4j:log4j-over-slf4j:$slf4jVersion"
runtime "org.apache.logging.log4j:log4j-to-slf4j:2.7"
testImplementation "org.springframework:spring-test:$springVersion"
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-all:1.10.19"
providedCompile "javax.servlet:servlet-api:2.5"
providedCompile "javax.servlet.jsp:jsp-api:2.1"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
allprojects {
apply plugin: 'eclipse'
artifacts {
archives sourcesJar
archives javadocJar
}
group = 'eu.dariah.de.minfba'
version = '4.0-SNAPSHOT'
tasks.withType(Deb) {
dependsOn(classes)
doLast {
project.debFile = archiveName;
repositories {
mavenLocal()
maven {
url = 'https://minfba.de.dariah.eu/nexus/repository/minfba-central/'
}
}
}
tasks.withType(Rpm) {
dependsOn(classes)
doLast {
project.rpmFile = archiveName;
ext {
coreVersion = "6.1-SNAPSHOT"
gtfVersion = "2.0.0-SNAPSHOT"
processingVersion = "4.1.0-SNAPSHOT"
colregModelVersion = "4.3.4-RELEASE"
dariahSpVersion = "2.1.6-RELEASE"
jsonAssertVersion = "1.5.0"
jodaTimeVersion = "2.10.10"
commonsTextVersion = "1.9"
commonsCompressVersion = "1.20"
commonsIoVersion = "2.8.0"
commonsCodecVersion = "1.15"
tikaVersion = "1.25"
mockitoVersion = "3.8.0"
mavenRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-central/'
releasesRepo = "https://minfba.de.dariah.eu/nexus/repository/minfba-releases/"
snapshotsRepo = "https://minfba.de.dariah.eu/nexus/repository/minfba-snapshots/"
aptReleasesRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-apt-releases/'
aptTestingRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-apt-testing/'
yumRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-yum/'
repoUser = project.hasProperty('nexususer') ? project.getProperty('nexususer') : '?';
repoPass = project.hasProperty('nexuspass') ? project.getProperty('nexuspass') : ''
// Filled dynamically by packaging tasks
debFile = ""
rpmFile = ""
aptRepo = ""
}
}
ospackage {
os = LINUX
arch = 'all'
packageName "dariah-$project.name"
replaces "$project.name"
maintainer 'info@de.dariah.eu'
requires('openjdk-8-jdk').or('openjdk-11-jdk')
signingKeyId('CB012F105B632B46C2A7B4918FC46DAC1BC3E238')
into "var/dfa/webapps/$project.name/"
from(configurations.runtime) {
into "WEB-INF/lib"
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'io.spring.dependency-management'
from("$buildDir/classes/java/main") {
into "WEB-INF/classes"
}
// https://stackoverflow.com/a/53824670
configurations {
implementation {
exclude group: 'xml-apis', module: 'xml-apis'
exclude group: 'xml-apis', module: 'xml-apis-ext'
exclude group: 'xerces', module: 'xercesImpl'
}
}
from ("src/main/resources") {
into "WEB-INF/classes"
java {
sourceCompatibility = JavaVersion.VERSION_11
}
from ("src/main/webapp/WEB-INF") {
into "WEB-INF"
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
from ("src/main/webapp/resources") {
into "resources"
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
from ("src/main/webapp/themes") {
into "themes"
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
from ("src/main/webapp/META-INF") {
into "META-INF"
artifacts {
archives sourcesJar
archives javadocJar
}
}
publishing {
publications {
maven(MavenPublication) {
from(components.web)
artifact(sourcesJar) {}
artifact(javadocJar) {}
pom {
name = 'DARIAH-DE Generic Search'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
dependencyManagement {
imports {
mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
}
}
publishing {
publications {
maven(MavenPublication) {
pom {
name = 'DARIAH-DE Generic Search'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search/'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
developers {
developer {
id = 'tgradl'
name = 'Tobias Gradl'
email = 'tobias.gradl@uni-bamberg.de'
developers {
developer {
id = 'tgradl'
name = 'Tobias Gradl'
email = 'tobias.gradl@uni-bamberg.de'
}
}
scm {
connection = 'scm:git:git://gitlab.rz.uni-bamberg.de/dariah/search.git'
developerConnection = 'scm:git:git://gitlab.rz.uni-bamberg.de/dariah/search.git'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search'
}
issueManagement {
system = 'GitLab'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search/issues'
}
}
scm {
connection = 'scm:git:git://gitlab.rz.uni-bamberg.de/dariah/search.git'
developerConnection = 'scm:git:ssh://gitlab.rz.uni-bamberg.de/dariah/search.git'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search'
}
issueManagement {
system = 'GitLab'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search/issues'
}
}
}
}
repositories {
maven {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
credentials {
username repoUser
password repoPass
repositories {
maven {
def releasesRepoUrl = "https://minfba.de.dariah.eu/nexus/repository/minfba-releases/"
def snapshotsRepoUrl = "https://minfba.de.dariah.eu/nexus/repository/minfba-snapshots/"
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
credentials {
username project.hasProperty('nexususer') ? project.getProperty('nexususer') : ''
password project.hasProperty('nexuspass') ? project.getProperty('nexuspass') : ''
}
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
} else {
// Have a local test repo under buildDir to be able to test publish but only actually do publish when the version ending matches
url = "$buildDir/repo/"
}
url = version.endsWith('SNAPSHOT') ? snapshotsRepo : releasesRepo
} else {
// Have a local test repo under buildDir to be able to test publish but only actually do publish when the version ending matches
url = "$buildDir/repo/"
}
}
}
}
task publishDebPackage {
dependsOn buildDeb
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Debian package $debFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "-H", "Content-Type: multipart/form-data", "--data-binary", "@$distroPath$debFile", "$aptRepo";
}
}
}
}
task publishRpmPackage {
dependsOn buildRpm
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Rpm package $rpmFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "--upload-file", "$distroPath$rpmFile", "$yumRepo/dariah/${project.name}/${project.version}/$rpmFile";
}
}
}
}
publish.finalizedBy publishDebPackage
//publish.finalizedBy publishRpmPackage
\ No newline at end of file
......@@ -29,13 +29,6 @@ tasks.withType(Deb) {
}
}
tasks.withType(Rpm) {
dependsOn(site)
doLast {
project.rpmFile = archiveName;
}
}
ospackage {
os = LINUX
arch = 'noarch'
......@@ -63,21 +56,4 @@ task publishDebPackage {
}
}
task publishRpmPackage {
dependsOn buildRpm
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Rpm package $rpmFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "--upload-file", "$distroPath$rpmFile", "$yumRepo/dariah/${project.name}/${project.version}/$rpmFile";
}
}
}
}
task publish {
dependsOn publishDebPackage
dependsOn publishRpmPackage
}
\ No newline at end of file
publish.finalizedBy publishDebPackage
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""