rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

pom_file generate pom.xml without project header.

Open Jungle666 opened this issue 3 years ago • 2 comments

I define a pom_file

pom_file(
    name = "yak_core_pom",
    targets = [
        "//yakboot/yak-core",
    ],
    template_file = "pom_template.xml",
)

when i build this file , it generate pom like image

we expected like

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://maven.apache.org/POM/4.0.0"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <artifactId>yak-core</artifactId>
.......

anyone can help?

Jungle666 avatar Dec 24 '21 02:12 Jungle666

This is WAI, the pom_file rule only generates the dependency closure, which is the complex part of the pom file. Have you tried writing a simple genrule that adds the header you want to the generated pom?

jin avatar Jan 13 '22 01:01 jin

The rule does a substitution within the pom file. A basic one might look something like:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <groupId>{groupId}</groupId>
  <artifactId>{artifactId}</artifactId>
  <version>{version}</version>
  <dependencies>
{dependencies}
  </dependencies>
</project>

shs96c avatar Feb 21 '22 10:02 shs96c