Use mvn install-file
diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml
index 290dff0..f9129e8 100644
--- a/.github/workflows/test_java.yml
+++ b/.github/workflows/test_java.yml
@@ -99,38 +99,23 @@
run: |
mv ${{ steps.build-protoc.outputs.protoc }} protoc
sudo rm -rf _build
- - name: Generate pom.xml files from the template
+ - name: Generate maven artifacts with bazel and install using maven
uses: protocolbuffers/protobuf-ci/bazel-docker@v3
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: java_linux/11
bash: |
- bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom
- mkdir -p generatedPoms
- cp bazel-bin/java/core/core_mvn-pom.xml generatedPoms/core_mvn-pom.xml
- cp bazel-bin/java/core/lite_mvn-pom.xml generatedPoms/lite_mvn-pom.xml
- cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml
- cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml
- cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mvn-pom.xml
- - name: Copy the generated pom.xml files to a copy of the java repository
- run: |
- cp -r java testMaven
- cp -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml
- cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml
- cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml
- cp -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml
- cp -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml
- - name: Install snapshot version locally (using generated pom.xml)
- run: |
- mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true
- working-directory: testMaven
+ bazel build //java:release
+ mvn install:install-file -Dfile=bazel-bin/java/core/core_mvn-project.jar -DpomFile=bazel-bin/java/core/core_mvn-pom.xml
+ mvn install:install-file -Dfile=bazel-bin/java/core/lite_mvn-project.jar -DpomFile=bazel-bin/java/core/lite_mvn-pom.xml
+ mvn install:install-file -Dfile=bazel-bin/java/kotlin-lite/kotlin-lite_mvn-project.jar -DpomFile=bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml
+ mvn install:install-file -Dfile=bazel-bin/java/kotlin/kotlin_mvn-project.jar -DpomFile=bazel-bin/java/kotlin/kotlin_mvn-pom.xml
+ mvn install:install-file -Dfile=bazel-bin/java/util/util_mvn-project.jar -DpomFile=bazel-bin/java/util/util_mvn-pom.xml
- name: Validate Protobuf BOM
uses: googleapis/java-cloud-bom/tests/validate-bom@fd56f04bb0bc581776a74031591f0b3bc5e7920a # v26.13.0
with:
- bom-path: testMaven/bom/pom.xml
+ bom-path: java/bom/pom.xml
- name: Clean up
run: |
sudo rm -rf _build
- sudo rm -rf generatedPoms
- sudo rm -rf testMaven