Commit 07fab41c authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

Migrated to Gradle

parent 156177e4
Pipeline #13295 passed with stages
in 2 minutes and 23 seconds
**/target/
### Eclipse ###
.metadata
bin/
tmp/
......@@ -16,9 +11,6 @@ local.properties
.loadpath
.recommenders
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
......@@ -31,8 +23,8 @@ local.properties
# CDT-specific (C/C++ Development Tooling)
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
......@@ -55,11 +47,26 @@ local.properties
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated
.sts4-cache/
### Java ###
# Compiled class file
*.class
......@@ -76,6 +83,7 @@ local.properties
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
......@@ -84,4 +92,25 @@ local.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# End of https://www.gitignore.io/api/java,eclipse
### Java-Web ###
## ignoring target file
target/
### Gradle ###
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Gradle Patch ###
**/build/
image: maven:latest
image: java:8-jdk
variables:
MAVEN_CLI_OPTS: "--batch-mode"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
NEXUS_CREDENTIALS: "-Pnexususer=$NEXUS_REPO_USER -Pnexuspass=$NEXUS_REPO_PASS"
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS compile
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- ./gradlew wrapper --gradle-version=5.6.4 --distribution-type=bin
test:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
cache:
paths:
- .gradle/wrapper
- .gradle/caches
stages:
- build
- deploy
build:
stage: build
script: ./gradlew assemble
deploy:
stage: deploy
script:
- VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
- |
if [[ $VERSION = *"SNAPSHOT" || $VERSION = *"RELEASE" ]]; then
echo "Pushing $VERSION"
mvn $MAVEN_CLI_OPTS deploy
fi
script:
- ./gradlew publish -x test $NEXUS_CREDENTIALS
only:
- master
\ No newline at end of file
- master
/*buildscript {
repositories {
maven { url 'https://repo.spring.io/plugins-snapshot' }
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE'
}
}*/
allprojects {
//apply plugin: "io.spring.dependency-management"
apply plugin: "maven-publish"
group = 'eu.dariah.de'
version = '1.3.0-SNAPSHOT'
repositories {
mavenLocal()
maven {
url = 'https://minfba.de.dariah.eu/nexus/repository/minfba-central/'
}
}
publishing {
publications {
maven(MavenPublication) {
pom {
name = 'DARIAHSP'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/dariahsp'
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'
}
}
scm {
connection = 'scm:git:git://gitlab.rz.uni-bamberg.de/dariah/dariahsp.git'
developerConnection = 'scm:git:ssh://gitlab.rz.uni-bamberg.de/dariah/dariahsp.git'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/dariahsp/'
}
issueManagement {
system = 'GitLab'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/dariahsp/issues'
}
}
}
}
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/"
}
}
}
}
}
subprojects {
apply plugin: "java"
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
}
artifacts {
archives sourcesJar
archives javadocJar
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
artifact(sourcesJar) {}
artifact(javadocJar) {}
}
}
}
}
\ No newline at end of file
dependencies {
compile 'org.springframework.security:spring-security-core:4.2.1.RELEASE'
compile 'de.unibamberg.minf.core:core-metamodel:5.1.2-RELEASE'
compile 'de.unibamberg.minf.core:core-util:5.1.2-RELEASE'
compile 'eu.dariah.eu:spring-security-saml2-core:1.0.3-SNAPSHOT'
compile 'org.springframework:spring-webmvc:4.3.6.RELEASE'
compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'joda-time:joda-time:2.9.2'
compile 'org.slf4j:slf4j-api:1.7.22'
compile 'org.slf4j:jcl-over-slf4j:1.7.22'
compile 'commons-net:commons-net:3.6'
}
description = 'dariahsp - core library'
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.dariah.de</groupId>
<artifactId>dariahsp</artifactId>
<version>1.2.2-SNAPSHOT</version>
</parent>
<artifactId>dariahsp-core</artifactId>
<name>dariahsp - core library</name>
<description>DARIAH wrapper to the Spring Security Saml Project</description>
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>
<dependency>
<groupId>de.unibamberg.minf.core</groupId>
<artifactId>core-metamodel</artifactId>
<version>${de.unibamberg.minf.core.core-metamodel.version}</version>
</dependency>
<dependency>
<groupId>de.unibamberg.minf.core</groupId>
<artifactId>core-util</artifactId>
<version>${de.unibamberg.minf.core.core-util.version}</version>
</dependency>
<dependency>
<groupId>eu.dariah.eu</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>${spring-security-saml2-core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time-version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<!-- Commons -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<version>${eu.dariah.de.dariahsp.dariahsp-core.version}</version>
</project>
plugins {
id 'war'
}
dependencies {
compile project(':dariahsp-core')
compile 'de.unibamberg.minf.core:core-web:5.1.2-RELEASE'
compile 'org.springframework:spring-context:4.3.6.RELEASE'
compile 'org.springframework:spring-core:4.3.6.RELEASE'
compile 'org.springframework:spring-beans:4.3.6.RELEASE'
compile 'org.springframework:spring-webmvc:4.3.6.RELEASE'
compile 'org.apache.tiles:tiles-core:3.0.7'
compile 'org.apache.tiles:tiles-jsp:3.0.7'
compile 'org.apache.tiles:tiles-api:3.0.7'
compile 'javax.servlet:jstl:1.2'
compile 'org.yaml:snakeyaml:1.18'
testCompile 'org.springframework:spring-test:4.3.6.RELEASE'
testCompile 'junit:junit:4.12'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
providedCompile 'javax.servlet.jsp:jsp-api:2.2'
}
description = 'dariahsp - sample web application'
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.dariah.de</groupId>
<artifactId>dariahsp</artifactId>
<version>1.2.2-SNAPSHOT</version>
</parent>
<artifactId>dariahsp-sample</artifactId>
<packaging>war</packaging>
<name>dariahsp - sample web application</name>
<description>Sample application for testing dariahsp-core</description>
<properties>
<org.apache.tiles-version>3.0.7</org.apache.tiles-version>
<de.unibamberg.minf.core.core-web.version>5.1.2-RELEASE</de.unibamberg.minf.core.core-web.version>
</properties>
<dependencies>
<!-- DARIAH libraries -->
<dependency>
<groupId>eu.dariah.de</groupId>
<artifactId>dariahsp-core</artifactId>
<version>${eu.dariah.de.dariahsp.dariahsp-core.version}</version>
</dependency>
<dependency>
<groupId>de.unibamberg.minf.core</groupId>
<artifactId>core-web</artifactId>
<version>${de.unibamberg.minf.core.core-web.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${org.apache.tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${org.apache.tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>${org.apache.tiles-version}</version>
</dependency>
<!-- Other Web dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<!-- Backend test (user persistence) -->
<!-- <dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency> -->
<!-- For YAML based configurations -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.18</version>
</dependency>
<!-- Test Artifacts -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<version>${eu.dariah.de.dariahsp.dariahsp-sample.version}</version>
</project>
......@@ -14,11 +14,6 @@ import eu.dariah.de.dariahsp.exceptions.UserCredentialsException;
/**
*
* @author tobias
*
* Requires web.xml adaption:
* <error-page>
* <location>/errors</location>
* </error-page>
*
*/
@Controller
......
package eu.dariah.de.dariahsp.sample.exceptions;
import javax.activity.InvalidActivityException;
//import javax.activity.InvalidActivityException;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
......@@ -20,10 +20,10 @@ public class SampleExceptionHandler {
public static final String DEFAULT_ERROR_VIEW = "error";
@ResponseStatus(HttpStatus.CONFLICT) // 409
@ExceptionHandler(InvalidActivityException.class)
public void handleConflict() {
// Nothing to do, just to show how individual errors could be handled
}
// @ExceptionHandler(InvalidActivityException.class)
// public void handleConflict() {
// // Nothing to do, just to show how individual errors could be handled
// }
@ExceptionHandler(value = Exception.class)
public String defaultErrorHandler(Model m, HttpServletRequest req, Exception e) throws Exception {
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-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* )