adoroszlai commented on PR #8299:
URL: https://github.com/apache/ozone/pull/8299#issuecomment-2814875144

   > I also noticed that we already set the `@XmlSchema` annotations in 
https://github.com/apache/ozone/blob/master/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/package-info.java,
 which should have automatically annotated all the XML related fields with the 
default namespace. Not sure why the default namespace doesn't take any effect.
   
   @ivandika3 Thanks a lot for the pointer to `package-info.java`.  Looking at 
`maven-compiler-plugin` history between 3.9.0 and 3.10.0, it seems tests are 
broken by 
https://github.com/apache/maven-compiler-plugin/commit/40dd50fd81dc0c7832c90e0744e84d85a384517b
 
([doc](https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#createMissingPackageInfoClass)).
  I think the problem is that the `package-info.java` for test sources does not 
have the `XmlSchema` annotation:
   
   
https://github.com/apache/ozone/blob/d8a391558f239355ed2f53580f7cc7fe86becfac/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/package-info.java#L21-L29
   
   
https://github.com/apache/ozone/blob/d8a391558f239355ed2f53580f7cc7fe86becfac/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/package-info.java#L18-L21
   
   Thus class file generation kicks in with 3.10.0 or later:
   
   ```
   451 
hadoop-ozone/s3gateway/target/classes/org/apache/hadoop/ozone/s3/endpoint/package-info.class
   141 
hadoop-ozone/s3gateway/target/test-classes/org/apache/hadoop/ozone/s3/endpoint/package-info.class
   ```
   
   With version 3.9.0, `package-info.class` does not exist in `test-classes`, 
so the one from `classes` is found on the classpath of the unit test.
   
   We can fix it by one of:
   1. setting `maven.compiler.createMissingPackageInfoClass=false`
   2. adding the same annotation to `package-info.java` in test sources
   
   I prefer (1) to retain existing behavior.
   
   In either case, we don't need to add the namespace to `XmlElement`s.
   
   Since replacing hard-coded URL with constant is not related to the version 
bump, I suggest splitting the change:
   
   - replace hard-coded URL with constant (part of this PR + in any other 
places where string is wrapped curently)
   - bump compiler + add setting (I can take this)
   
   What do you think?


-- 
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.

To unsubscribe, e-mail: [email protected]

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