1

Is the maven-release-plugin able to update a variable to actual release version in a source file?

As an example, if I have the following class in the source tree:

/**
 * Does actually nothing
 * 
 * @since ${project.version}
 */
public class NewClass {
  ...
}

the maven release plugin could replace the variable ${project.version} with the actual version of the generated release.

radlan
  • 2,393
  • 4
  • 33
  • 53
  • If you really need this which I have my doubts about ...see here: https://www.mojohaus.org/templating-maven-plugin/ – khmarbaise Nov 07 '18 at 07:40

1 Answers1

0

Getting the version in the source itself requires an additional plugin and can be a bit tricky (see Generate a Version.java file in Maven). It may be better to write to the version to a text/config file like in the question Using maven to output the version number to a text file and reference that file from the javadoc like in Javadoc link to src/main/resource or src/test/resource file using relative path

Or since your aim is to use a maven property (version) in javadoc, you could follow the suggestion in Using maven properties in JavaDoc, which is to put the version in a config file with maven filtering and read that into a java class that can then be referenced directly in the javadoc

Ryan Dawson
  • 11,832
  • 5
  • 38
  • 61