diff --git a/assembly/assembly-wsagent-war/pom.xml b/assembly/assembly-wsagent-war/pom.xml index 5a71c86e6b..493cf97f6e 100644 --- a/assembly/assembly-wsagent-war/pom.xml +++ b/assembly/assembly-wsagent-war/pom.xml @@ -208,6 +208,25 @@ WEB-INF/lib/jsr305*.jar + + + org.apache.maven.plugins + maven-antrun-plugin + + + buildinfo + process-resources + + run + + + + che.product.build_info = ${build.info} + + + + + diff --git a/assembly/assembly-wsmaster-war/pom.xml b/assembly/assembly-wsmaster-war/pom.xml index beff3c2a90..d98383d3ad 100644 --- a/assembly/assembly-wsmaster-war/pom.xml +++ b/assembly/assembly-wsmaster-war/pom.xml @@ -536,6 +536,25 @@ + + + org.apache.maven.plugins + maven-antrun-plugin + + + buildinfo + process-resources + + run + + + + che.product.build_info = ${build.info} + + + + + diff --git a/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/ApiInfoProvider.java b/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/ApiInfoProvider.java index aa5823d117..7629ea53b1 100644 --- a/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/ApiInfoProvider.java +++ b/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/ApiInfoProvider.java @@ -15,10 +15,9 @@ import java.io.InputStream; import java.util.jar.Attributes; import java.util.jar.Manifest; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.ws.rs.core.Context; import org.eclipse.che.api.core.rest.shared.dto.ApiInfo; import org.eclipse.che.dto.server.DtoFactory; import org.slf4j.Logger; @@ -37,8 +36,8 @@ public class ApiInfoProvider implements Provider { private ApiInfo apiInfo; @Inject - public ApiInfoProvider(@Context ServletContext context) { - this.apiInfo = readApiInfo(context); + public ApiInfoProvider(@Named("che.product.build_info") String buildInfo) { + this.apiInfo = readApiInfo(buildInfo); } @Override @@ -46,10 +45,12 @@ public class ApiInfoProvider implements Provider { return apiInfo; } - private ApiInfo readApiInfo(ServletContext context) { + private ApiInfo readApiInfo(String buildInfo) { try { - try (InputStream inputStream = context.getResourceAsStream("/META-INF/MANIFEST.MF")) { - final Manifest manifest = new Manifest(inputStream); + try (InputStream manifestInputStream = + ApiInfoProvider.class.getResourceAsStream("/META-INF/MANIFEST.MF")) { + + final Manifest manifest = new Manifest(manifestInputStream); final Attributes mainAttributes = manifest.getMainAttributes(); final DtoFactory dtoFactory = DtoFactory.getInstance(); return dtoFactory @@ -59,8 +60,10 @@ public class ApiInfoProvider implements Provider { .withSpecificationTitle("Che REST API") .withSpecificationVersion(mainAttributes.getValue("Specification-Version")) .withImplementationVersion(mainAttributes.getValue("Implementation-Version")) - .withScmRevision(mainAttributes.getValue("SCM-Revision")); + .withScmRevision(mainAttributes.getValue("SCM-Revision")) + .withBuildInfo(buildInfo); } + } catch (Exception e) { LOG.error("Unable to read API info. Error: " + e.getMessage(), e); throw new RuntimeException("Unable to read API information", e); diff --git a/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/shared/dto/ApiInfo.java b/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/shared/dto/ApiInfo.java index 2286eaaa1c..6575ebe12d 100644 --- a/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/shared/dto/ApiInfo.java +++ b/core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/shared/dto/ApiInfo.java @@ -57,4 +57,10 @@ public interface ApiInfo { ApiInfo withIdeVersion(String ideVersion); void setIdeVersion(String ideVersion); + + String getBuildInfo(); + + ApiInfo withBuildInfo(String buildInfo); + + void setBuildInfo(String buildInfo); } diff --git a/dashboard/src/components/branding/che-branding.factory.ts b/dashboard/src/components/branding/che-branding.factory.ts index 97bad65900..0cec5f13d4 100644 --- a/dashboard/src/components/branding/che-branding.factory.ts +++ b/dashboard/src/components/branding/che-branding.factory.ts @@ -102,7 +102,7 @@ export class CheBranding { updateVersion(): void { this.cheService.fetchServicesInfo().then(() => { let info = this.cheService.getServicesInfo(); - this.$rootScope.productVersion = (info && info.implementationVersion) ? info.implementationVersion : ''; + this.$rootScope.productVersion = (info && info.buildInfo) ? info.buildInfo : ''; }); } diff --git a/ide/che-ide-gwt-app/pom.xml b/ide/che-ide-gwt-app/pom.xml index 011d03590d..e935630603 100644 --- a/ide/che-ide-gwt-app/pom.xml +++ b/ide/che-ide-gwt-app/pom.xml @@ -198,7 +198,7 @@ revision = ${revision} buildTime = ${timestamp} - version = ${project.version} + version = ${build.info} diff --git a/pom.xml b/pom.xml index 5d53ce2d35..dba7b9cb40 100644 --- a/pom.xml +++ b/pom.xml @@ -48,6 +48,7 @@ https://github.com/eclipse/che + ${project.version} 7.0.0-beta-3.0-SNAPSHOT 7.0.0-beta-3.0-SNAPSHOT 7.0.0-beta-3.0-SNAPSHOT