简体   繁体   中英

Maven archetype: Reference artifactId in markdown site files

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?

对于archetype-metadata.xml的各个文件集,需要设置filtered=true

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM