xuxiaowei-com-cn opened a new issue, #8178:
URL: https://github.com/apache/incubator-seata/issues/8178

   ### Check Ahead
   
   - [x] I have searched the [issues](https://github.com/seata/seata/issues) of 
this repository and believe that this is not a duplicate.
   
   - [x] I am willing to try to fix this bug myself.
   
   
   ### Ⅰ. Issue Description
   
   The `console` module uses `java.net.http.HttpClient` (introduced in Java 
11), but the module is compiled with Java 8 compatibility settings inherited 
from the parent POM. This causes compilation errors when running in IDEA.
   
   
   ### Ⅱ. Describe what happened
   
   When running the `console` module in IDEA, a compilation error related to 
`java.net.http.HttpClient` occurs:
   
   <img width="2092" height="1365" alt="Image" 
src="https://github.com/user-attachments/assets/e32d08b3-928d-4f30-a457-4e44f69309aa";
 />
   
   
   **Root Cause Analysis:**
   
   1. `java.net.http.HttpClient` was added in Java 11.
      ![img.png](img.png)
   2. The `console` module does not explicitly configure `java.version`, 
`maven.compiler.source`, or `maven.compiler.target`.
   3. The `console` module's parent is `org.apache.seata:seata-parent`, which 
also does not define these properties.
   4. `org.apache.seata:seata-parent`'s parent is 
`org.apache.seata:seata-build`, which configures:
      ```xml
      <java.version>1.8</java.version>
      <maven.compiler.source>${java.version}</maven.compiler.source>
      <maven.compiler.target>${java.version}</maven.compiler.target>
      ```
   5. As a result, the `console` module inherits Java 1.8 compile target, but 
the source code uses `java.net.http.HttpClient` which requires Java 11+.
   
   ### Ⅲ. Describe what you expected to happen
   
   The `console` module should compile successfully with a Java version that 
supports `java.net.http.HttpClient` (Java 11+), without compilation errors in 
IDEA.
   
   
   ### Ⅳ. How to reproduce it (as minimally and precisely as possible)
   
   
   1. Open the Seata project in IntelliJ IDEA.
   2. Navigate to the `console` module.
   3. Observe the compilation error on `java.net.http.HttpClient` usage — it 
will be flagged as unavailable because the module is configured with Java 1.8 
source/target level.
   4. The error occurs because `java.net.http.HttpClient` is available starting 
from Java 11, but the inherited Maven compiler settings target Java 1.8.
   
   
   ### Ⅴ. Anything else we need to know?
   
   
   The fix is to add the following properties to `console/pom.xml`:
   
   ```xml
   <java.version>17</java.version>
   <maven.compiler.source>${java.version}</maven.compiler.source>
   <maven.compiler.target>${java.version}</maven.compiler.target>
   ```
   
   This overrides the inherited Java 1.8 setting from `seata-build` and aligns 
with the Spring Boot 4.0.6 / Spring Framework 7.0.7 baseline already used in 
the console module.
   
   
   ### Ⅵ. Environment
   
   _No response_


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