This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new abf77735c build(server): keep H2 out of the distributed fat JAR (#6346)
abf77735c is described below

commit abf77735c16360cab0a91817dcde4e83e1ba45aa
Author: lizhimins <[email protected]>
AuthorDate: Mon Oct 12 17:52:27 2026 +0800

    build(server): keep H2 out of the distributed fat JAR (#6346)
    
    `com.h2database:h2` had no `<scope>`, so it defaulted to `compile` and 
`h2-2.4.240.jar` shipped inside the distributed fat JAR. H2 is dual-licensed 
MPL-2.0 / EPL-1.0 — ASF **Category B**, which needs legal review before it can 
go into a binary release.
    
    Nothing needs it in the artifact:
    
    - no source under `server/src/main` references H2 (only 
`application-dev.yml` names `org.h2.Driver`, and that is a dev-profile 
resource);
    - `deploy/docker-compose.yml:53` runs `SPRING_PROFILES_ACTIVE=prod` against 
MySQL;
    - the only consumers are the `dev` profile and the schema-migration tests 
under `server/src/test` (`CloudCredentialSchemaMigrationTest`, 
`AlertSchemaMigrationTest`, `AiConversationSchemaMigrationTest`, 
`SettingsWritePersistenceTest`, `ResourceOwnershipGuardTest`, ...), all of 
which get it from `test` scope.
    
    `mysql-connector-j` is already handled the same way for the opposite reason 
(GPL / Category X → `provided` + downloaded by the Dockerfile), and the pom 
comment right above it says as much.
    
    Verified:
    
    ```
    $ mvn -B -ntp package -DskipTests -Dmaven.antrun.skip=true   # antrun = 
binary-license-gate, tracked separately
    BOOT-INF/lib entries: 279 -> 278
    h2 in BOOT-INF/lib:   none
    $ mvn -B -ntp -T 8 test -Dspring.profiles.active=dev
    Tests run: 3523, Failures: 0, Errors: 0
    ```
    
    One flake worth recording rather than hiding: 
`ResourceOwnershipGuardTest.migrationConcurrentStartupIsIdempotentTest` errored 
once in the parallel run with `org.h2.jdbc.JdbcSQLNonTransientException: 
General error: "java.util.ConcurrentModificationException"` from 
`JdbcDatabaseMetaData.getIndexInfo`, and passes 33/33 in isolation — an H2 
metadata race under `-T 8`, not a consequence of this change (the test 
classpath jar is byte-identical either way).
    
    **Behaviour change:** running the *packaged* JAR with 
`-Dspring.profiles.active=dev` now needs H2 supplied externally (`java -cp 
"app.jar:h2-2.4.240.jar" ...`), since `LOADER_PATH`/PropertiesLauncher already 
supports extra directories. `mvn test -Dspring.profiles.active=dev` is 
unaffected. This is recorded in the pom comment.
---
 server/pom.xml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/pom.xml b/server/pom.xml
index 98e209b38..d7a347c2f 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -132,9 +132,17 @@
             <artifactId>mysql-connector-j</artifactId>
             <scope>provided</scope>
         </dependency>
+        <!-- H2 backs the `dev` profile and the schema-migration tests only; 
nothing under src/main
+             references it and the container runs `prod` against MySQL. 
Scope=test keeps it out of the
+             distributed fat JAR: it is dual MPL-2.0/EPL-1.0, i.e. ASF 
Category B, which needs legal
+             review to ship in a binary release, and there is no reason to 
ship it.
+             Consequence: running the packaged JAR with 
-Dspring.profiles.active=dev needs H2 on the
+             classpath (java -cp "app.jar:h2-*.jar" ...); `mvn test 
-Dspring.profiles.active=dev` is
+             unaffected because the tests get it from this scope. -->
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
+            <scope>test</scope>
         </dependency>
         <!-- RocketMQ Admin Tools (kept from trunk #694) -->
         <dependency>

Reply via email to