summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-09-06 11:43:41 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-09-06 11:43:41 -0700
commitac1abc2b5b6f629726fad04045acda8ee33e047f (patch)
treef05c2ffe4956efa28744e35842d0fe26008005b5
parent3fdf98d67f6c8a24c535635599d380a104bd93f2 (diff)
Add git commit info in version-check output
Change-Id: I82973ea3239cf21b0aa6a3a0b172667edd253b43 Issue-ID: INT-124 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
-rw-r--r--version-manifest/pom.xml17
-rw-r--r--version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java16
2 files changed, 31 insertions, 2 deletions
diff --git a/version-manifest/pom.xml b/version-manifest/pom.xml
index 884199e6f..331f357ad 100644
--- a/version-manifest/pom.xml
+++ b/version-manifest/pom.xml
@@ -68,6 +68,23 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>pl.project13.maven</groupId>
+ <artifactId>git-commit-id-plugin</artifactId>
+ <version>2.2.3</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>revision</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
+ <generateGitPropertiesFile>true</generateGitPropertiesFile>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java b/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java
index 5d4e9a8fa..325ca5811 100644
--- a/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java
+++ b/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java
@@ -17,6 +17,7 @@
package org.onap.integration.versionmanifest;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.nio.charset.StandardCharsets;
@@ -25,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
@@ -59,7 +61,17 @@ public class VersionCheckMojo extends AbstractMojo {
public void execute() throws MojoExecutionException {
final Log log = getLog();
- log.info("Checking version manifest " + manifest);
+ final Properties gitProps = new Properties();
+ try (InputStream in = getClass().getResourceAsStream("/git.properties")) {
+ gitProps.load(in);
+ } catch (IOException e) {
+ log.error(e);
+ throw new MojoExecutionException(e.getMessage());
+ }
+
+ log.info("Manifest version: " + gitProps.getProperty("git.remote.origin.url") + " "
+ + gitProps.getProperty("git.commit.id") + " " + gitProps.getProperty("git.build.time"));
+
log.info("");
final List<String> groupIdPrefixes = Arrays.asList("org.onap", "org.openecomp", "org.openo");
@@ -105,7 +117,7 @@ public class VersionCheckMojo extends AbstractMojo {
String artifact = actualVersion.getKey();
String expectedVersion = expectedVersions.get(artifact);
if (expectedVersion == null) {
- if (artifact.startsWith("org.onap") || artifact.startsWith("org.openecomp")) {
+ if (groupIdPrefixes.stream().anyMatch(prefix -> artifact.startsWith(prefix))) {
missingArtifacts.add(artifact);
}
} else if (!expectedVersion.equals(actualVersion)) {