maven - How to download dependencies using bazel -
i new bazel. need download external dependency jar files using bazel. configure download external jar files. tried add jar files in build , workspace files , not working
appreciate quick response
workspace file
maven_server(name="myserver",url="https://mvnrepository.com/artifact/org.apache.flink/flink-java") maven_jar(name="flink-java",artifact="org.apache.flink:filnk-java:jar:1.2.0",server="myserver") bind(name="flink-java",actual="@flink-java//jar") build file
java_binary( name="read_files", srcs = glob(["readfiles.java"]), main_class="com.ibm.cdo.gts.contracts.pipeline.preprocess.readfiles", deps=["//external:flink-java"], ) thanks,
the logical mistake have there workspace name (flink-java) illegal [1] [2].
needed change - _ in maven_jar , of course reference in bind.
maven_jar(name="flink_java",artifact="org.apache.flink:flink-java:jar:1.2.0") bind(name="flink-java",actual="@flink_java//jar") two more mistakes had in above were:
- in artifact coordinates wrote
filnk-javawhen neededflink-java - the mvnrepository url used doesn't seem legal. tried few variants couldn't work. additionally site seem link downloads maven central i'm not sure server jars. having said since
bazelfallbacks maven central omittedmaven_server, build passes. if needmaven_serverpart , need use private maven repository please double check url first.
p.s.- have helped if added question bazel outputs since needed create own workspace know problems encountered. many times people ignore question without enough details.
luck.
[1] https://bazel.build/versions/master/docs/be/workspace.html#maven_jar_name
[2] https://bazel.build/versions/master/docs/be/functions.html#workspace
Comments
Post a Comment