${ao:getProjectVersion()}

Gets the version of a Maven project given its groupId and artifactId.

Searches in the following order:

  1. Look for a web resource META-INF/maven/groupId/artifactId/pom.properties, relative to the given lib directory (which itself is interpreted relative to the current page.

    This is for dependencies that have been expanded into the project as overlays.

  2. Next searches the application classpath via Projects.getVersion(String groupId, String artifactId).

    This is for dependencies that have been included as dependencies, most likely in the WEB-INF/lib folder.

  3. Finally, if not found, returns the provided default value. This default value will typically be set via a build-time filter, such as 8.0.0-SNAPSHOT.

    This is to fallback to build-time dependencies when no runtime version information can be found.

Example

${ao:getProjectVersion(lib, groupId, artifactId, def)}

Function Information

Function Class: com.aoapps.taglib.Functions
Function Signature: java.lang.String getProjectVersion(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
Display Name: None