w1100n
This site is best viewed in Google Chrome
3/22/2020 13:34

https://stackoverflow.com/questions/3532135/using-maven-to-output-the-version-number-to-a-text-file

Create a text file somewhere in src/main/resources, call it version.txt (or whatever)

File content:

${project.version}

now in your pom.xml, inside the build element, put this block:

<build>
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>true</filtering>
      <includes>
        <include>**/version.txt</include>
      </includes>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>false</filtering>
      <excludes>
        <exclude>**/version.txt</exclude>
      </excludes>
    </resource>
    ...
  </resources>
</build>

<< Previous Posts Newer Posts >>
普萝谷 辽ICP备14012896