From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

maven: fix "recursive expression cycle" problem

For a long time (possibly since the beginning) when building
modules with java code using maven, we would be getting
warnings about using ${version} expression in pom.xml:

"[WARNING] 'version' contains an expression but should be a constant. @ 
io.osv:java-parent:${version}, 
/home/wkozaczuk/projects/osv/modules/java-base/pom.xml, line 13, column 14"

Starting with maven 3.6.3 (the one Ubuntu 20.04 comes with)
we would see errors preventing building and running tests like so:
"[ERROR] Resolving expression: '${version}': Detected the following recursive 
expression cycle in 'version': [version] @ io.osv:runjava-isolated:${version}, 
/home/wkozaczuk/projects/osv/modules/java-base/runjava-isolated/pom.xml
[ERROR] 'dependencies.dependency.version' for io.osv:runjava-common:jar is 
missing. @ io.osv:runjava-isolated:${version}, 
/home/wkozaczuk/projects/osv/modules/java-base/runjava-isolated/pom.xml, line 
20, column 22
[ERROR] Resolving expression: '${version}': Detected the following recursive 
expression cycle in 'version': [version] @ 
io.osv:runjava-non-isolated:${version}, 
/home/wkozaczuk/projects/osv/modules/java-base/runjava-non-isolated/pom.xml
[ERROR] 'dependencies.dependency.version' for io.osv:runjava-common:jar is 
missing. @ io.osv:runjava-non-isolated:${version}, 
/home/wkozaczuk/projects/osv/modules/java-base/runjava-non-isolated/pom.xml, 
line 20, column 22"

This patch fixes it by hardcoding version of parent pom project to
'1.0-SNAPSHOT' instead of declaring a variable.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/modules/httpserver-jolokia-plugin/jolokia-agent/pom.xml 
b/modules/httpserver-jolokia-plugin/jolokia-agent/pom.xml
--- a/modules/httpserver-jolokia-plugin/jolokia-agent/pom.xml
+++ b/modules/httpserver-jolokia-plugin/jolokia-agent/pom.xml
@@ -2,13 +2,9 @@
        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>
 
-    <properties>
-        <version>1.0-SNAPSHOT</version>
-    </properties>
-
     <groupId>io.osv</groupId>
     <artifactId>jolokia-agent</artifactId>
-    <version>${version}</version>
+    <version>1.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <dependencies>
diff --git a/modules/java-base/pom.xml b/modules/java-base/pom.xml
--- a/modules/java-base/pom.xml
+++ b/modules/java-base/pom.xml
@@ -4,13 +4,9 @@
                       http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
 
-    <properties>
-        <version>1.0-SNAPSHOT</version>
-    </properties>
-
     <groupId>io.osv</groupId>
     <artifactId>java-parent</artifactId>
-    <version>${version}</version>
+    <version>1.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <modules>
diff --git a/modules/java-base/runjava-common/pom.xml 
b/modules/java-base/runjava-common/pom.xml
--- a/modules/java-base/runjava-common/pom.xml
+++ b/modules/java-base/runjava-common/pom.xml
@@ -7,7 +7,7 @@
     <parent>
         <groupId>io.osv</groupId>
         <artifactId>java-parent</artifactId>
-        <version>${version}</version>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>runjava-common</artifactId>
diff --git a/modules/java-base/runjava-isolated/pom.xml 
b/modules/java-base/runjava-isolated/pom.xml
--- a/modules/java-base/runjava-isolated/pom.xml
+++ b/modules/java-base/runjava-isolated/pom.xml
@@ -7,7 +7,7 @@
     <parent>
         <groupId>io.osv</groupId>
         <artifactId>java-parent</artifactId>
-        <version>${version}</version>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>runjava-isolated</artifactId>
diff --git a/modules/java-base/runjava-non-isolated/pom.xml 
b/modules/java-base/runjava-non-isolated/pom.xml
--- a/modules/java-base/runjava-non-isolated/pom.xml
+++ b/modules/java-base/runjava-non-isolated/pom.xml
@@ -7,7 +7,7 @@
     <parent>
         <groupId>io.osv</groupId>
         <artifactId>java-parent</artifactId>
-        <version>${version}</version>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>runjava-non-isolated</artifactId>
diff --git a/modules/java-mgmt/cloudius/pom.xml 
b/modules/java-mgmt/cloudius/pom.xml
--- a/modules/java-mgmt/cloudius/pom.xml
+++ b/modules/java-mgmt/cloudius/pom.xml
@@ -4,13 +4,9 @@
                       http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
 
-    <properties>
-        <version>1.0-SNAPSHOT</version>
-    </properties>
-
     <groupId>io.osv</groupId>
     <artifactId>cloudius</artifactId>
-    <version>${version}</version>
+    <version>1.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <build>
diff --git a/modules/java-tests/pom.xml b/modules/java-tests/pom.xml
--- a/modules/java-tests/pom.xml
+++ b/modules/java-tests/pom.xml
@@ -4,13 +4,9 @@
                       http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
 
-    <properties>
-        <version>1.0-SNAPSHOT</version>
-    </properties>
-
     <groupId>io.osv</groupId>
     <artifactId>java-tests-parent</artifactId>
-    <version>${version}</version>
+    <version>1.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <modules>
diff --git a/modules/java-tests/tests-isolates/pom.xml 
b/modules/java-tests/tests-isolates/pom.xml
--- a/modules/java-tests/tests-isolates/pom.xml
+++ b/modules/java-tests/tests-isolates/pom.xml
@@ -7,7 +7,7 @@
     <parent>
         <groupId>io.osv</groupId>
         <artifactId>java-tests-parent</artifactId>
-        <version>${version}</version>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>tests-isolates</artifactId>
diff --git a/modules/java-tests/tests-jre-extension/pom.xml 
b/modules/java-tests/tests-jre-extension/pom.xml
--- a/modules/java-tests/tests-jre-extension/pom.xml
+++ b/modules/java-tests/tests-jre-extension/pom.xml
@@ -7,7 +7,7 @@
     <parent>
         <groupId>io.osv</groupId>
         <artifactId>java-tests-parent</artifactId>
-        <version>${version}</version>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>tests-jre-extension</artifactId>
diff --git a/modules/java-tests/tests/pom.xml b/modules/java-tests/tests/pom.xml
--- a/modules/java-tests/tests/pom.xml
+++ b/modules/java-tests/tests/pom.xml
@@ -7,7 +7,7 @@
     <parent>
         <groupId>io.osv</groupId>
         <artifactId>java-tests-parent</artifactId>
-        <version>${version}</version>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>runjava-tests</artifactId>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000e6fa4605a5a5f03e%40google.com.

Reply via email to