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

@ -214,7 +214,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore />
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
@ -287,6 +287,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<!--

View File

@ -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

View File

@ -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<List<String>> getDomains() {
return new ResponseEntity<>(taskanaEngineConfiguration.getDomains(), HttpStatus.OK);
@ -90,7 +86,7 @@ public class TaskanaEngineController {
public ResponseEntity<VersionResource> 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);
}

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