Maven archetype: Reference artifactId in markdown site files

559 views Asked by At

I am creating a maven archetype. It should contain some predefined files in src/site/markdown. These files should include the artifactId.

I tried to reference it using ${artifactId} inside the md file but no luck.

Any other idea?

2

There are 2 answers

0
J Fabian Meier On BEST ANSWER

For the respective fileset in the archetype-metadata.xml one need to set filtered=true.

1
Paththa On

I had the same problem and this is how I fixed it.

In the resources/META-INF/maven/archetype-metadata.xml, I added

<fileSet encoding="UTF-8" filtered="true">
  <directory></directory>
  <includes>
    <include>README.md</include>
  </includes>
</fileSet>

Then in the resources/archetype-resources/README.md I added

The name of the project is ${artifactId}

Now when I build a maven project using this archetype, I have the value of artifactId populated in the README.md file.