Is it possible to expand the maven properties\' scope on javadocs using Maven Javadoc Plugin? E.g.
/**
* My Awesome Class
* @version ${project.version}
**/
I think you try like this. This is two step process: First is to load the pom property into static field Second to use the static field to set the javadoc property
Create a app.properties
in src/main/resources
with content like this
application.version=${project.version}
then enable maven filtering like this
src/main/resources
true
In application code just read properties file
public class MVNLinksHolder{
public static String version = "";
public MVNLinksHolder(){
ClassPathResource resource = new ClassPathResource( "app.properties" );
Properties p = new Properties();
InputStream inputStream = null;
try {
inputStream = resource.getInputStream();
p.load( inputStream );
version = p.getProperty("application.version");
}
catch ( IOException e ) {
LOGGER.error( e.getMessage(), e );
}
finally {
Closeables.closeQuietly( inputStream );
}
}
}
Then use it to set the version
/**
* My Awesome Class
* @version = {@value MVNLinksHolder#version}
**/