elek commented on a change in pull request #1777:
URL: https://github.com/apache/ozone/pull/1777#discussion_r555576295



##########
File path: pom.xml
##########
@@ -72,8 +72,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xs
     <hadoop.version>3.2.1</hadoop.version>
 
     <!-- version for hdds/ozone components -->
-    <hdds.version>${ozone.version}</hdds.version>
-    <ozone.version>1.1.0-SNAPSHOT</ozone.version>
+    <hdds.version>${project.version}</hdds.version>
+    <ozone.version>${project.version}</ozone.version>

Review comment:
       This is unsafe. "${project.version}" points to the version of the 
current project not to the version of this pom.xml.
   
   Imagine this example:
    
    1. create a new project (ozone-tools:2.0.1-SNAPSHOT) where the parent 
project is `org.apache.hadoop:hadoop-main-ozone:1.1.0-SNAPSHOT).
    
     2. `ozone.version` will be evaluated as `2.0.1-SNAPSHOT`
     
     We have seen this problem when we used Hadoop parent pom from Ozone.
     
     try with this pom:
     
     ```
   <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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <parent>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-main-ozone</artifactId>
       <version>1.1.0-SNAPSHOT</version>
     </parent>
     <artifactId>testproject</artifactId>
     <version>2.1.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <dependencies>
     <dependency>
           <groupId>org.apache.hadoop</groupId>
           <artifactId>hadoop-ozone-client</artifactId>
           <version>${ozone.version}</version>
     </dependency>
     </dependencies>
   </project>
   ```
   
   The error is:
   
   ```
   [ERROR] Failed to execute goal on project testproject: Could not resolve 
dependencies for project org.apache.hadoop:testproject:pom:2.1.0-SNAPSHOT: 
Failure to find org.apache.hadoop:hadoop-ozone-client:jar:2.1.0-SNAPSHOT in 
https://repository.apache.org/content/repositories/snapshots was cached in the 
local repository, resolution will not be reattempted until the update interval 
of apache.snapshots.https has elapsed or updates are forced -> [Help 1]
   ```

##########
File path: hadoop-ozone/dev-support/checks/blockade.sh
##########
@@ -17,7 +17,7 @@
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 cd "$DIR/../../.." || exit 1
 
-OZONE_VERSION=$(grep "<ozone.version>" "$DIR/../../pom.xml" | sed 
's/<[^>]*>//g'|  sed 's/^[ \t]*//')
+OZONE_VERSION=$(mvn help:evaluate -Dexpression=ozone.version -q -DforceStdout)

Review comment:
       Smart trick, like it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to