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

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git


The following commit(s) were added to refs/heads/main by this push:
     new f9c6fcc49 fix(scala): preserve local maven resolver (#3765)
f9c6fcc49 is described below

commit f9c6fcc49d8824bf05397628a2f8f217dbce95a1
Author: Shawn Yang <[email protected]>
AuthorDate: Sat Jun 13 19:55:32 2026 +0800

    fix(scala): preserve local maven resolver (#3765)
    
    ## Why?
    
    
    
    ## What does this PR do?
    
    
    
    ## Related issues
    
    
    
    ## AI Contribution Checklist
    
    
    
    - [ ] Substantial AI assistance was used in this PR: `yes` / `no`
    - [ ] If `yes`, I included a completed [AI Contribution
    
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
    in this PR description and the required `AI Usage Disclosure`.
    - [ ] If `yes`, my PR description includes the required `ai_review`
    summary and screenshot evidence of the final clean AI review results
    from both fresh reviewers on the current PR diff or current HEAD after
    the latest code changes.
    
    
    
    ## Does this PR introduce any user-facing change?
    
    
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
---
 .github/workflows/ci.yml | 49 ++++++++++++++++--------------------------------
 scala/build.sbt          | 10 +++++++---
 2 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3695560c3..dee626009 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -594,8 +594,6 @@ jobs:
     needs: changes
     if: needs.changes.outputs.scala == 'true'
     runs-on: ubuntu-latest
-    env:
-      FORY_SCALA_MAVEN_LOCAL: /tmp/fory-scala-m2/repository
     steps:
       - uses: actions/checkout@v5
       - name: Set up JDK11
@@ -603,26 +601,22 @@ jobs:
         with:
           java-version: 11
           distribution: "temurin"
-          cache: sbt
-      - name: Cache Maven local repository
-        uses: actions/cache@v4
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
       - uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
+        with:
+          disk-cache: false
       - name: Install fory java
-        run: cd java && mvn -T10 --no-transfer-progress clean install 
-DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true 
-Dmaven.repo.local="$FORY_SCALA_MAVEN_LOCAL" && cd -
+        run: |
+          cd java
+          mvn -T10 --no-transfer-progress clean deploy -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true 
-DaltDeploymentRepository=fory-local::default::file://${RUNNER_TEMP}/fory-maven-repo
       - name: Test
+        env:
+          SBT_OPTS: -Dfory.maven.repo=file://${{ runner.temp }}/fory-maven-repo
         run: |
           cd scala && sbt +test && cd -
 
   scala_xlang:
     name: Scala Xlang Test
     runs-on: ubuntu-latest
-    env:
-      FORY_SCALA_MAVEN_LOCAL: /tmp/fory-scala-m2/repository
     steps:
       - uses: actions/checkout@v5
       - name: Set up JDK 21
@@ -630,34 +624,27 @@ jobs:
         with:
           java-version: 21
           distribution: "temurin"
-          cache: sbt
       - name: Set up Python 3.11
         uses: actions/setup-python@v5
         with:
           python-version: 3.11
-      - name: Cache Maven local repository
-        uses: actions/cache@v4
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
       - uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
+        with:
+          disk-cache: false
       - name: Run Scala Xlang Test
         env:
           FORY_SCALA_JAVA_CI: "1"
           ENABLE_FORY_DEBUG_OUTPUT: "1"
+          SBT_OPTS: -Dfory.maven.repo=file://${{ runner.temp }}/fory-maven-repo
         run: |
           cd java
-          mvn -T16 --no-transfer-progress clean install -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true 
-Dmaven.repo.local="$FORY_SCALA_MAVEN_LOCAL"
+          mvn -T16 --no-transfer-progress clean deploy -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true 
-DaltDeploymentRepository=fory-local::default::file://${RUNNER_TEMP}/fory-maven-repo
           cd fory-core
           mvn -T16 --no-transfer-progress test 
-Dtest=org.apache.fory.xlang.ScalaXlangTest
 
   scala_idl:
     name: Scala IDL Tests
     runs-on: ubuntu-latest
-    env:
-      FORY_SCALA_MAVEN_LOCAL: /tmp/fory-scala-m2/repository
     steps:
       - uses: actions/checkout@v5
       - name: Set up JDK 21
@@ -665,24 +652,20 @@ jobs:
         with:
           java-version: 21
           distribution: "temurin"
-          cache: sbt
       - name: Set up Python 3.11
         uses: actions/setup-python@v5
         with:
           python-version: 3.11
-      - name: Cache Maven local repository
-        uses: actions/cache@v4
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
       - uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
+        with:
+          disk-cache: false
       - name: Install Fory Java
         run: |
           cd java
-          mvn -T16 --no-transfer-progress clean install -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true 
-Dmaven.repo.local="$FORY_SCALA_MAVEN_LOCAL"
+          mvn -T16 --no-transfer-progress clean deploy -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true 
-DaltDeploymentRepository=fory-local::default::file://${RUNNER_TEMP}/fory-maven-repo
       - name: Run Scala IDL Tests
+        env:
+          SBT_OPTS: -Dfory.maven.repo=file://${{ runner.temp }}/fory-maven-repo
         run: ./integration_tests/idl_tests/run_scala_tests.sh
 
   integration_tests:
diff --git a/scala/build.sbt b/scala/build.sbt
index baa8ab594..c28d33f6c 100644
--- a/scala/build.sbt
+++ b/scala/build.sbt
@@ -18,13 +18,17 @@
 
 val foryVersion = "1.2.0-SNAPSHOT"
 val scala213Version = "2.13.15"
-val foryMavenLocal =
-  sys.env.get("FORY_SCALA_MAVEN_LOCAL").map(file).getOrElse(Path.userHome / 
".m2" / "repository")
 ThisBuild / apacheSonatypeProjectProfile := "fory"
 version := foryVersion
 scalaVersion := scala213Version
 crossScalaVersions := Seq(scala213Version, "3.3.1")
 
+val localForyResolver =
+  sys.props
+    .get("fory.maven.repo")
+    .map(repo => "Local Fory Maven Repository" at repo)
+    .getOrElse(Resolver.mavenLocal)
+
 lazy val root = Project(id = "fory-scala", base = file("."))
   .settings(
     name := "fory-scala",
@@ -43,7 +47,7 @@ lazy val root = Project(id = "fory-scala", base = file("."))
 ThisBuild / externalResolvers := Seq(
   Resolver.mavenCentral,
   Resolver.ApacheMavenSnapshotsRepo,
-  Resolver.file("fory-maven-local", 
foryMavenLocal)(Resolver.mavenStylePatterns),
+  localForyResolver,
 )
 
 libraryDependencies ++= Seq(


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

Reply via email to