tree: f20fd9438bbf8a1998d2b349f399abad3fbd53d8 [path history] [tgz]
  1. java/
  2. .bazelversion
  3. BUILD
  4. maven_install.json
  5. MODULE.bazel
  6. pom_template.xml
  7. README.md
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>