tree: 995769363a741b335eb57d1189ddec2087dfd53d [path history] [tgz]
  1. java/
  2. .bazelversion
  3. BUILD
  4. pom_template.xml
  5. README.md
  6. WORKSPACE
examples/pom_file_generation/README.md

Generating <dependency> nodes for a POM file

This example shows how you can generate the <dependencies> section of a POM file using rules_jvm_external's generated targets and the pom_file rule from bazel-common.

To generate the XML for the example Java library, build the //:my_library_pom target:

$ bazel build //:my_library_pom

The generated my_library_pom.xml will then contain the dependency nodes for the Java library's direct dependencies:

$ cat bazel-bin/my_library_pom.xml
<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>27.1-jre</version>
</dependency>
<dependency>
  <groupId>com.google.inject</groupId>
  <artifactId>guice</artifactId>
  <version>4.0</version>
</dependency>