From da0eb34d1ec67dd55085c44297baf46dfedad8aa Mon Sep 17 00:00:00 2001 From: Martin Rojas Miguel Angel Date: Thu, 28 Mar 2019 08:54:08 +0100 Subject: [PATCH] bug/837 Get implementation version from package meta information instead of spring configuration --- lib/taskana-core/pom.xml | 597 +++++++++--------- .../src/main/resources/application.properties | 3 - .../taskana/rest/TaskanaEngineController.java | 6 +- .../rest/resource/ConfigurationTest.java | 14 + 4 files changed, 319 insertions(+), 301 deletions(-) create mode 100644 rest/taskana-rest-spring/src/test/java/pro/taskana/rest/resource/ConfigurationTest.java diff --git a/lib/taskana-core/pom.xml b/lib/taskana-core/pom.xml index da78a4718..bee8f716a 100644 --- a/lib/taskana-core/pom.xml +++ b/lib/taskana-core/pom.xml @@ -1,303 +1,314 @@ - 4.0.0 - pro.taskana - taskana-core - 1.1.1-SNAPSHOT + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + pro.taskana + taskana-core + 1.1.1-SNAPSHOT - ${project.groupId}:${project.artifactId} - The taskana library to include in your project. - http://taskana.pro + ${project.groupId}:${project.artifactId} + The taskana library to include in your project. + http://taskana.pro - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + - - - Holger Hagen - holger.hagen@novatec-gmbh.de - NovaTec Consulting GmbH - https://www.novatec-gmbh.de - - + + + Holger Hagen + holger.hagen@novatec-gmbh.de + NovaTec Consulting GmbH + https://www.novatec-gmbh.de + + - - scm:git:git://github.com/taskana/taskana.git - scm:git:ssh://github.com:taskana/taskana.git - http://github.com/taskana/taskana/tree/master - + + scm:git:git://github.com/taskana/taskana.git + scm:git:ssh://github.com:taskana/taskana.git + http://github.com/taskana/taskana/tree/master + - - 1.8 - 1.8 - UTF-8 - 1.7.1 - + + 1.8 + 1.8 + UTF-8 + 1.7.1 + - - - snapshot - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - false - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - release - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - false - - - - - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - + + + snapshot + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + - - - org.mybatis - mybatis - 3.4.5 - - - org.slf4j - slf4j-api - 1.7.25 - - - org.json - json - 20180130 - - - - junit - junit - 4.12 - test - - - org.mockito - mockito-core - 2.8.47 - test - - - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - org.powermock - powermock-api-mockito2 - ${powermock.version} - test - - - com.h2database - h2 - 1.4.196 - test - - - org.postgresql - postgresql - 42.2.2 - test - - - com.ibm.db2.jcc - db2jcc4 - 11.1.1.1 - test - - - org.apache.logging.log4j - log4j-slf4j-impl - 2.8.1 - test - - - org.apache.logging.log4j - log4j-core - 2.8.1 - test - - - com.fasterxml.jackson.core - jackson-databind - 2.9.8 - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [1.0.0,) - - check - - - - - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.17 - - - validate - validate - - ../../qa/checkstyle/checkstyle.xml - UTF-8 - true - true - true - true - - - check - - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - true - - -Xlint:all - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - - - - - - novatec public - novatec-repository - https://repository.novatec-gmbh.de/content/repositories/novatec/ - - + + + org.mybatis + mybatis + 3.4.5 + + + org.slf4j + slf4j-api + 1.7.25 + + + org.json + json + 20180130 + + + + junit + junit + 4.12 + test + + + org.mockito + mockito-core + 2.8.47 + test + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + + + com.h2database + h2 + 1.4.196 + test + + + org.postgresql + postgresql + 42.2.2 + test + + + com.ibm.db2.jcc + db2jcc4 + 11.1.1.1 + test + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.8.1 + test + + + org.apache.logging.log4j + log4j-core + 2.8.1 + test + + + com.fasterxml.jackson.core + jackson-databind + 2.9.8 + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + [1.0.0,) + + check + + + + + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + + validate + validate + + ../../qa/checkstyle/checkstyle.xml + UTF-8 + true + true + true + true + + + check + + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + true + + -Xlint:all + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + + + + + + + + + + novatec public + novatec-repository + https://repository.novatec-gmbh.de/content/repositories/novatec/ + + diff --git a/rest/taskana-rest-spring-example/src/main/resources/application.properties b/rest/taskana-rest-spring-example/src/main/resources/application.properties index 6f43e7363..87ae822ae 100644 --- a/rest/taskana-rest-spring-example/src/main/resources/application.properties +++ b/rest/taskana-rest-spring-example/src/main/resources/application.properties @@ -22,9 +22,6 @@ devMode=false ####### property that control if the database is cleaned and sample data is generated generateSampleData=true -####### Property that informs about the Taskana's version. This version is shown the application web -version=@project.version@ - ####### control LDAP usage taskana.ldap.useLdap=false ####### properties to connect to LDAP diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/TaskanaEngineController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/TaskanaEngineController.java index 4995684a3..d9db0f95c 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/TaskanaEngineController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/TaskanaEngineController.java @@ -2,7 +2,6 @@ package pro.taskana.rest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -35,9 +34,6 @@ public class TaskanaEngineController { this.taskanaEngine = taskanaEngine; } - @Value("${version:Local build}") - private String version; - @GetMapping(path = "/v1/domains", produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity> getDomains() { return new ResponseEntity<>(taskanaEngineConfiguration.getDomains(), HttpStatus.OK); @@ -90,7 +86,7 @@ public class TaskanaEngineController { public ResponseEntity currentVersion() { LOGGER.debug("Entry to currentVersion()"); VersionResource resource = new VersionResource(); - resource.setVersion(version); + resource.setVersion(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion()); LOGGER.debug("Exit from currentVersion(), returning {}", new ResponseEntity<>(resource, HttpStatus.OK)); return new ResponseEntity<>(resource, HttpStatus.OK); } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/rest/resource/ConfigurationTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/rest/resource/ConfigurationTest.java new file mode 100644 index 000000000..aa4da3767 --- /dev/null +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/rest/resource/ConfigurationTest.java @@ -0,0 +1,14 @@ +package pro.taskana.rest.resource; + +import org.junit.Test; +import pro.taskana.configuration.TaskanaEngineConfiguration; + +import static org.junit.Assert.assertNotNull; + +public class ConfigurationTest { + + @Test + public void testImplementationVersionIsInTaskanaCorePackage() { + assertNotNull(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion()); + } +}