Changing BUILD files and adding pom templates
diff --git a/java/core/BUILD b/java/core/BUILD
index 4d8895a..d41eb4c 100644
--- a/java/core/BUILD
+++ b/java/core/BUILD
@@ -1,7 +1,9 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library", "java_proto_library", "java_lite_proto_library")
+load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("//:internal.bzl", "conformance_test")
+load("//:version.bzl", "VERSION")
load("//java/internal:testing.bzl", "junit_tests")
LITE_SRCS = [
@@ -96,14 +98,19 @@
]
# Should be used as `//java/lite`.
-java_library(
+java_export(
name = "lite",
+ maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % VERSION,
+ pom_template = "//java/lite:pom_template.xml",
srcs = LITE_SRCS + [
"//:gen_well_known_protos_javalite"
],
visibility = [
"//java/lite:__pkg__",
],
+ resources = [
+ "//:lite_well_known_protos",
+ ],
)
java_library(
@@ -111,8 +118,10 @@
srcs = LITE_SRCS,
)
-java_library(
+java_export(
name = "core",
+ maven_coordinates = "com.google.protobuf:protobuf-java:%s" % VERSION,
+ pom_template = "pom_template.xml",
srcs = glob(
[
"src/main/java/com/google/protobuf/*.java",
@@ -128,6 +137,9 @@
deps = [
":lite_runtime_only",
],
+ resources = [
+ "//:well_known_protos",
+ ],
)
proto_lang_toolchain(
@@ -324,3 +336,4 @@
"//external:truth",
]
)
+
diff --git a/java/core/pom_template.xml b/java/core/pom_template.xml
new file mode 100644
index 0000000..2c61281
--- /dev/null
+++ b/java/core/pom_template.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>{groupId}</groupId>
+ <artifactId>protobuf-parent</artifactId>
+ <version>{version}</version>
+ </parent>
+
+ <artifactId>{artifactId}</artifactId>
+ <packaging>{type}</packaging>
+
+ <name>Protocol Buffers [Core]</name>
+ <description>
+ Core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an
+ efficient yet extensible format.
+ </description>
+</project>
diff --git a/java/lite/BUILD b/java/lite/BUILD
index 639f308..35a1368 100644
--- a/java/lite/BUILD
+++ b/java/lite/BUILD
@@ -4,6 +4,7 @@
load("//java/internal:testing.bzl", "junit_tests")
exports_files(["lite.awk"], visibility = ["//java/core:__pkg__"])
+exports_files(["pom_template.xml"], visibility = ["//java/core:__pkg__"])
alias(
name = "lite",
diff --git a/java/lite/pom_template.xml b/java/lite/pom_template.xml
new file mode 100644
index 0000000..6d705fd
--- /dev/null
+++ b/java/lite/pom_template.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>{groupId}</groupId>
+ <artifactId>protobuf-parent</artifactId>
+ <version>{version}</version>
+ </parent>
+
+ <artifactId>{artifactId}</artifactId>
+ <packaging>{type}</packaging>
+
+ <name>Protocol Buffers [Lite]</name>
+ <description>
+ Lite version of Protocol Buffers library. This version is optimized for code size, but does
+ not guarantee API/ABI stability.
+ </description>
+
+</project>
diff --git a/java/util/BUILD b/java/util/BUILD
index 25853f7..47bacc4 100644
--- a/java/util/BUILD
+++ b/java/util/BUILD
@@ -1,9 +1,13 @@
-load("@rules_java//java:defs.bzl", "java_library", "java_proto_library")
+load("@rules_java//java:defs.bzl", "java_proto_library")
+load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_proto//proto:defs.bzl", "proto_library")
+load("//:version.bzl", "VERSION")
load("//java/internal:testing.bzl", "junit_tests")
-java_library(
+java_export(
name = "util",
+ maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % VERSION,
+ pom_template = "pom_template.xml",
srcs = glob([
"src/main/java/com/google/protobuf/util/*.java",
]),
@@ -13,7 +17,6 @@
"//external:gson",
"//external:guava",
"//java/core",
- "//java/lite",
],
)
diff --git a/java/util/pom_template.xml b/java/util/pom_template.xml
new file mode 100644
index 0000000..b20e62a
--- /dev/null
+++ b/java/util/pom_template.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>{groupId}</groupId>
+ <artifactId>protobuf-parent</artifactId>
+ <version>{version}</version>
+ </parent>
+
+ <artifactId>{artifactId}</artifactId>
+ <packaging>{type}</packaging>
+
+ <name>Protocol Buffers [Util]</name>
+ <description>Utilities for Protocol Buffers</description>
+
+ {dependencies}
+
+</project>