Skip to content

The Unified and Autonomous Development Platform

Test update parent pom version. Verify consistency of parent pom versions across projects in workspace.

robin shine03926fa1c2a0
diff --git a/archetype.artifact/pom.xml b/archetype.artifact/pom.xml
index 20e3b64022..4c5981ed3b 100644
--- a/archetype.artifact/pom.xml
+++ b/archetype.artifact/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>archetype.artifact</artifactId>
<name>PMEase Artifact Archetype</name>
diff --git a/archetype.plugin/pom.xml b/archetype.plugin/pom.xml
index a5bc99ed39..9123c6a7a8 100644
--- a/archetype.plugin/pom.xml
+++ b/archetype.plugin/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>archetype.plugin</artifactId>
<name>PMEase Plugin Archetype</name>
@@ -37,5 +37,4 @@
<url>http://artifact.pmease.com/</url>
</repository>
</repositories>
- <version>1.0.22</version>
</project>
diff --git a/archetype.product/pom.xml b/archetype.product/pom.xml
index 1e32a4e552..578983932c 100644
--- a/archetype.product/pom.xml
+++ b/archetype.product/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>archetype.product</artifactId>
<name>PMEase Product Archetype</name>
@@ -37,5 +37,4 @@
<url>http://artifact.pmease.com/</url>
</repository>
</repositories>
- <version>1.0.22</version>
</project>
diff --git a/commons.bootstrap/pom.xml b/commons.bootstrap/pom.xml
index 47b912b3e4..c108f847f9 100644
--- a/commons.bootstrap/pom.xml
+++ b/commons.bootstrap/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>parent.general</artifactId>
<groupId>com.pmease</groupId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.bootstrap</artifactId>
<build>
diff --git a/commons.jetty/pom.xml b/commons.jetty/pom.xml
index 70bb386973..140877bc1c 100644
--- a/commons.jetty/pom.xml
+++ b/commons.jetty/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>parent.general</artifactId>
<groupId>com.pmease</groupId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.jetty</artifactId>
<build>
@@ -70,5 +70,4 @@
<moduleClass>com.pmease.commons.jetty.JettyModule</moduleClass>
<jettyVersion>8.1.10.v20130312</jettyVersion>
</properties>
- <version>1.0.22</version>
</project>
diff --git a/commons.jsw/pom.xml b/commons.jsw/pom.xml
index 7bd310e772..00acba9000 100644
--- a/commons.jsw/pom.xml
+++ b/commons.jsw/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>parent.general</artifactId>
<groupId>com.pmease</groupId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.jsw</artifactId>
<build>
diff --git a/commons.loader/pom.xml b/commons.loader/pom.xml
index 029f2a714e..abc13b8b9d 100644
--- a/commons.loader/pom.xml
+++ b/commons.loader/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<build>
<plugins>
@@ -74,5 +74,4 @@
<properties>
<guiceVersion>3.0</guiceVersion>
</properties>
- <version>1.0.22</version>
</project>
diff --git a/commons.persistence/pom.xml b/commons.persistence/pom.xml
index 713e8384b4..80d9b0ae6b 100644
--- a/commons.persistence/pom.xml
+++ b/commons.persistence/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>parent.general</artifactId>
<groupId>com.pmease</groupId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.persistence</artifactId>
<build>
@@ -106,5 +106,4 @@
<hibernateVersion>4.2.0.Final</hibernateVersion>
<bonecpVersion>0.8.0-rc1</bonecpVersion>
</properties>
- <version>1.0.22</version>
</project>
diff --git a/commons.rest/pom.xml b/commons.rest/pom.xml
index 44fd45c702..07bdc8a9c5 100644
--- a/commons.rest/pom.xml
+++ b/commons.rest/pom.xml
@@ -3,11 +3,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>commons.rest</artifactId>
- <version>1.0.22</version>
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<build>
<plugins>
diff --git a/commons.security/pom.xml b/commons.security/pom.xml
index 26d7f8ad09..beb7c6ab8d 100644
--- a/commons.security/pom.xml
+++ b/commons.security/pom.xml
@@ -3,11 +3,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>commons.security</artifactId>
- <version>1.0.22</version>
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<build>
<plugins>
diff --git a/commons.test/pom.xml b/commons.test/pom.xml
index fd64322c32..1d7bed9ef3 100644
--- a/commons.test/pom.xml
+++ b/commons.test/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>parent.general</artifactId>
<groupId>com.pmease</groupId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.test</artifactId>
<build>
diff --git a/commons.util/pom.xml b/commons.util/pom.xml
index 55d346bc19..0e3f4a01e9 100644
--- a/commons.util/pom.xml
+++ b/commons.util/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.util</artifactId>
<build>
@@ -63,7 +63,7 @@
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.test</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -99,5 +99,4 @@
<url>http://artifact.pmease.com/</url>
</repository>
</repositories>
- <version>1.0.22</version>
</project>
diff --git a/commons.web/pom.xml b/commons.web/pom.xml
index dd5e4d4473..8490948c30 100644
--- a/commons.web/pom.xml
+++ b/commons.web/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>parent.general</artifactId>
<groupId>com.pmease</groupId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<artifactId>commons.web</artifactId>
<build>
@@ -85,5 +85,4 @@
<url>http://artifact.pmease.com/</url>
</repository>
</repositories>
- <version>1.0.22</version>
</project>
diff --git a/gitop/pom.xml b/gitop/pom.xml
index 22bb1f1d7f..884867a3c9 100644
--- a/gitop/pom.xml
+++ b/gitop/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
</parent>
<build>
<plugins>
@@ -95,7 +95,7 @@
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.jsw</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -147,5 +147,4 @@
<moduleClass>com.pmease.commons.product.ProductModule</moduleClass>
<aggregation>false</aggregation>
</properties>
- <version>1.0.22</version>
</project>
diff --git a/parent.general/pom.xml b/parent.general/pom.xml
index dff923830c..926bebca29 100644
--- a/parent.general/pom.xml
+++ b/parent.general/pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pmease</groupId>
<artifactId>parent.general</artifactId>
- <version>1.0.21</version>
+ <version>1.0.22</version>
<packaging>pom</packaging>
<prerequisites>
<maven>3.0</maven>
diff --git a/plugin.maven/src/main/java/com/pmease/plugin/maven/CheckProjectDependenciesMojo.java b/plugin.maven/src/main/java/com/pmease/plugin/maven/CheckProjectDependenciesMojo.java
index d5a8aea317..c44447890b 100644
--- a/plugin.maven/src/main/java/com/pmease/plugin/maven/CheckProjectDependenciesMojo.java
+++ b/plugin.maven/src/main/java/com/pmease/plugin/maven/CheckProjectDependenciesMojo.java
@@ -1,6 +1,7 @@
package com.pmease.plugin.maven;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -9,12 +10,20 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* @goal check-project-dependencies
@@ -48,6 +57,71 @@ public class CheckProjectDependenciesMojo extends AbstractMojo {
if (propsFile.exists()) {
Properties props = PluginUtils.loadProperties(propsFile);
projectVersions.put(props.getProperty("id"), props.getProperty("version"));
+ } else {
+ File pomFile = new File(projectDir, "pom.xml");
+ if (pomFile.exists()) {
+ try {
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = builder.parse(pomFile);
+ NodeList nodeList = document.getElementsByTagName("groupId");
+ String groupId = null;
+ if (nodeList.getLength() != 0) {
+ groupId = nodeList.item(0).getTextContent().trim();
+ }
+
+ nodeList = document.getElementsByTagName("artifactId");
+ if (nodeList.getLength() == 0) {
+ throw new MojoFailureException("Can not determine artifactId in POM '" +
+ pomFile.getAbsolutePath() + "'.");
+ }
+ String artifactId = nodeList.item(0).getTextContent().trim();
+
+ nodeList = document.getElementsByTagName("version");
+ String version = null;
+ if (nodeList.getLength() != 0)
+ version = nodeList.item(0).getTextContent().trim();
+
+ if (groupId == null) {
+ nodeList = document.getElementsByTagName("parent");
+ if (nodeList.getLength() == 0) {
+ throw new MojoFailureException("Unable to determine groupId in POM '" +
+ pomFile.getAbsolutePath() + "'.");
+ }
+ Element parentElement = (Element) nodeList.item(0);
+
+ nodeList = parentElement.getElementsByTagName("groupId");
+ if (nodeList.getLength() == 0) {
+ throw new MojoFailureException("Unable to determine groupId in POM '" +
+ pomFile.getAbsolutePath() + "'.");
+ }
+ groupId = nodeList.item(0).getTextContent().trim();
+ }
+
+ if (version == null) {
+ nodeList = document.getElementsByTagName("parent");
+ if (nodeList.getLength() == 0) {
+ throw new MojoFailureException("Unable to determine version in POM '" +
+ pomFile.getAbsolutePath() + "'.");
+ }
+ Element parentElement = (Element) nodeList.item(0);
+
+ nodeList = parentElement.getElementsByTagName("version");
+ if (nodeList.getLength() == 0) {
+ throw new MojoFailureException("Unable to determine version in POM '" +
+ pomFile.getAbsolutePath() + "'.");
+ }
+ version = nodeList.item(0).getTextContent().trim();
+ }
+
+ projectVersions.put(groupId + "." + artifactId, version);
+ } catch (ParserConfigurationException e) {
+ throw new MojoFailureException("Error parsing POM file '" + pomFile.getAbsolutePath() + "'.", e);
+ } catch (SAXException e) {
+ throw new MojoFailureException("Error parsing POM file '" + pomFile.getAbsolutePath() + "'.", e);
+ } catch (IOException e) {
+ throw new MojoFailureException("Error reading POM file '" + pomFile.getAbsolutePath() + "'.", e);
+ }
+ }
}
}
}
@@ -66,6 +140,18 @@ public class CheckProjectDependenciesMojo extends AbstractMojo {
}
}
}
+
+ MavenProject parentProject = project.getParent();
+ if (parentProject != null) {
+ String projectKey = parentProject.getGroupId() + "." + parentProject.getArtifactId();
+ String projectVersion = projectVersions.get(projectKey);
+ if (projectVersion != null) {
+ if (!projectVersion.equals(parentProject.getVersion())) {
+ errors.add("Parent project '" + projectKey + "' should use version '"
+ + projectVersion + "'");
+ }
+ }
+ }
if (aggregation) {
Set<String> dependencyKeys = new HashSet<String>();