So the BUILD structure are like below:
java:
/src/java/com/abc/code/Code.java
resources:
/src/resources/com/abc/code/application.properties
BUILD filegroups
filegroup(
name = "properties",
srcs = glob(["application.properties"])
visibility = ["//visibility:public"],
)
BUILD of app use filegroups as resources/classpath_resources
java_binary(
name = "app",
classpath_resources = [
"//src/resources/com/abc/code:properties",
],
# resources = [
# "//src/resources/com/abc/code:properties",
# ],
main_class = "com.abc.code.Code",
runtime_deps = [
":app_bin",
],
)
get null
back for Code.class.getResourceAsStream("application.properties");
and after checking the generated jar, found that application.properties sits in the top /
jar tf poc_delivery_system_app.jar
META-INF/
META-INF/MANIFEST.MF
application.properties
then update the code to Code.class.getResourceAsStream("/application.properties");
which works,
The question is why application.properties
is in the top level instead of something like /com/abc/code/application.properties