bug/837 Get implementation version from package meta information instead of spring configuration

This commit is contained in:
Martin Rojas Miguel Angel 2019-03-28 08:54:08 +01:00 committed by Holger Hagen
parent cc8e47b99a
commit da0eb34d1e
4 changed files with 319 additions and 301 deletions

View File

@ -1,303 +1,314 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>pro.taskana</groupId> <groupId>pro.taskana</groupId>
<artifactId>taskana-core</artifactId> <artifactId>taskana-core</artifactId>
<version>1.1.1-SNAPSHOT</version> <version>1.1.1-SNAPSHOT</version>
<name>${project.groupId}:${project.artifactId}</name> <name>${project.groupId}:${project.artifactId}</name>
<description>The taskana library to include in your project.</description> <description>The taskana library to include in your project.</description>
<url>http://taskana.pro</url> <url>http://taskana.pro</url>
<licenses> <licenses>
<license> <license>
<name>The Apache License, Version 2.0</name> <name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license> </license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>
<name>Holger Hagen</name> <name>Holger Hagen</name>
<email>holger.hagen@novatec-gmbh.de</email> <email>holger.hagen@novatec-gmbh.de</email>
<organization>NovaTec Consulting GmbH</organization> <organization>NovaTec Consulting GmbH</organization>
<organizationUrl>https://www.novatec-gmbh.de</organizationUrl> <organizationUrl>https://www.novatec-gmbh.de</organizationUrl>
</developer> </developer>
</developers> </developers>
<scm> <scm>
<connection>scm:git:git://github.com/taskana/taskana.git</connection> <connection>scm:git:git://github.com/taskana/taskana.git</connection>
<developerConnection>scm:git:ssh://github.com:taskana/taskana.git</developerConnection> <developerConnection>scm:git:ssh://github.com:taskana/taskana.git</developerConnection>
<url>http://github.com/taskana/taskana/tree/master</url> <url>http://github.com/taskana/taskana/tree/master</url>
</scm> </scm>
<properties> <properties>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powermock.version>1.7.1</powermock.version> <powermock.version>1.7.1</powermock.version>
</properties> </properties>
<profiles> <profiles>
<profile> <profile>
<id>snapshot</id> <id>snapshot</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version> <version>1.5</version>
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>
<phase>verify</phase> <phase>verify</phase>
<goals> <goals>
<goal>sign</goal> <goal>sign</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.sonatype.plugins</groupId> <groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId> <artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version> <version>1.6.8</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<serverId>ossrh</serverId> <serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl> <nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose> <autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<distributionManagement> <distributionManagement>
<snapshotRepository> <snapshotRepository>
<id>ossrh</id> <id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url> <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
</profile> </profile>
<profile> <profile>
<id>release</id> <id>release</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version> <version>1.5</version>
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>
<phase>verify</phase> <phase>verify</phase>
<goals> <goals>
<goal>sign</goal> <goal>sign</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.sonatype.plugins</groupId> <groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId> <artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version> <version>1.6.8</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<serverId>ossrh</serverId> <serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl> <nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose> <autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>ossrh</id> <id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
</profile> </profile>
</profiles> </profiles>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
<version>3.4.5</version> <version>3.4.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.25</version> <version>1.7.25</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
<artifactId>json</artifactId> <artifactId>json</artifactId>
<version>20180130</version> <version>20180130</version>
</dependency> </dependency>
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version> <version>4.12</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>2.8.47</version> <version>2.8.47</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId> <artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version> <version>${powermock.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId> <artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version> <version>${powermock.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.4.196</version> <version>1.4.196</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.2.2</version> <version>42.2.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.ibm.db2.jcc</groupId> <groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId> <artifactId>db2jcc4</artifactId>
<version>11.1.1.1</version> <version>11.1.1.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId> <artifactId>log4j-slf4j-impl</artifactId>
<version>2.8.1</version> <version>2.8.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
<version>2.8.1</version> <version>2.8.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.9.8</version> <version>2.9.8</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.eclipse.m2e</groupId> <groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId> <artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<configuration> <configuration>
<lifecycleMappingMetadata> <lifecycleMappingMetadata>
<pluginExecutions> <pluginExecutions>
<pluginExecution> <pluginExecution>
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange> <versionRange>[1.0.0,)</versionRange>
<goals> <goals>
<goal>check</goal> <goal>check</goal>
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore /> <ignore/>
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>
</lifecycleMappingMetadata> </lifecycleMappingMetadata>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version> <version>2.17</version>
<executions> <executions>
<execution> <execution>
<id>validate</id> <id>validate</id>
<phase>validate</phase> <phase>validate</phase>
<configuration> <configuration>
<configLocation>../../qa/checkstyle/checkstyle.xml</configLocation> <configLocation>../../qa/checkstyle/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput> <consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError> <failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation> <failOnViolation>true</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory> <includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration> </configuration>
<goals> <goals>
<goal>check</goal> <goal>check</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version> <version>3.5.1</version>
<configuration> <configuration>
<showWarnings>true</showWarnings> <showWarnings>true</showWarnings>
<compilerArgs> <compilerArgs>
<arg>-Xlint:all</arg> <arg>-Xlint:all</arg>
</compilerArgs> </compilerArgs>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version> <version>2.2.1</version>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
<goals> <goals>
<goal>jar-no-fork</goal> <goal>jar-no-fork</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version> <version>2.9.1</version>
<executions> <executions>
<execution> <execution>
<id>attach-javadocs</id> <id>attach-javadocs</id>
<goals> <goals>
<goal>jar</goal> <goal>jar</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> <plugin>
</build> <groupId>org.apache.maven.plugins</groupId>
<!-- <artifactId>maven-jar-plugin</artifactId>
this repository is needed to fetch com.ibm.db2.jcc <configuration>
--> <archive>
<repositories> <manifest>
<repository> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<id>novatec public</id> </manifest>
<name>novatec-repository</name> </archive>
<url>https://repository.novatec-gmbh.de/content/repositories/novatec/</url> </configuration>
</repository> </plugin>
</repositories> </plugins>
</build>
<!--
this repository is needed to fetch com.ibm.db2.jcc
-->
<repositories>
<repository>
<id>novatec public</id>
<name>novatec-repository</name>
<url>https://repository.novatec-gmbh.de/content/repositories/novatec/</url>
</repository>
</repositories>
</project> </project>

View File

@ -22,9 +22,6 @@ devMode=false
####### property that control if the database is cleaned and sample data is generated ####### property that control if the database is cleaned and sample data is generated
generateSampleData=true generateSampleData=true
####### Property that informs about the Taskana's version. This version is shown the application web
version=@project.version@
####### control LDAP usage ####### control LDAP usage
taskana.ldap.useLdap=false taskana.ldap.useLdap=false
####### properties to connect to LDAP ####### properties to connect to LDAP

View File

@ -2,7 +2,6 @@ package pro.taskana.rest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -35,9 +34,6 @@ public class TaskanaEngineController {
this.taskanaEngine = taskanaEngine; this.taskanaEngine = taskanaEngine;
} }
@Value("${version:Local build}")
private String version;
@GetMapping(path = "/v1/domains", produces = {MediaType.APPLICATION_JSON_VALUE}) @GetMapping(path = "/v1/domains", produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<List<String>> getDomains() { public ResponseEntity<List<String>> getDomains() {
return new ResponseEntity<>(taskanaEngineConfiguration.getDomains(), HttpStatus.OK); return new ResponseEntity<>(taskanaEngineConfiguration.getDomains(), HttpStatus.OK);
@ -90,7 +86,7 @@ public class TaskanaEngineController {
public ResponseEntity<VersionResource> currentVersion() { public ResponseEntity<VersionResource> currentVersion() {
LOGGER.debug("Entry to currentVersion()"); LOGGER.debug("Entry to currentVersion()");
VersionResource resource = new VersionResource(); VersionResource resource = new VersionResource();
resource.setVersion(version); resource.setVersion(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion());
LOGGER.debug("Exit from currentVersion(), returning {}", new ResponseEntity<>(resource, HttpStatus.OK)); LOGGER.debug("Exit from currentVersion(), returning {}", new ResponseEntity<>(resource, HttpStatus.OK));
return new ResponseEntity<>(resource, HttpStatus.OK); return new ResponseEntity<>(resource, HttpStatus.OK);
} }

View File

@ -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());
}
}