the hibernate-annotations and hibernate-commons-annotations version since these should match. We’ll do this by creating a property called hibernate-annotations-version. The resulting simple-parent section looks like this:
<project>
...
<properties>
<hibernate.annotations.version>3.3.0.ga</hibernate.annotations.version>
</properties>
<dependencyManagement>
...
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>${hibernate.annotations.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernate.annotations.version}</version>
</dependency>
...
</dependencyManagement>
...
</project>
If you put this XML in a pom.xml and run mvn help:effective-pom, you will see that the output contains the line:
<version>3.3.0.ga</version>
Maven provides three implicit variables which can be used to access environment variables, POM information, and Maven Settings:
- env
- The
envvariable exposes environment variables exposed by your operating system or shell. For example, a reference to${env.PATH}in a Maven POM would be replaced by the${PATH}environment variable (or%PATH%in Windows). - project
- The
projectvariable exposes the POM. You can use a dot-notated (.) path to reference the value of a POM element. For example, in this section we used thegroupIdandartifactIdto set thefinalNameelement in the build configuration. The syntax for this property reference was:${project.groupId}-${project.artifactId}. - settings
- The
settingsvariable exposes Maven settings information. You can use a dot-notated (.) path to reference the value of an element in asettings.xmlfile. For example,${settings.offline}would reference the value of theofflineelement in~/.m2/settings.xml.
In addition to the three implicit variables, you can reference system properties and any custom properties set in the Maven POM or in a build profile:
- Java System Properties
- All properties accessible via
getProperties()onjava.lang.Systemare exposed as POM properties. Some examples of system properties are:${user.name},${user.home},${java.home}, and${os.name}. A full list of system properties can be found in the Javadoc for thejava.lang.Systemclass.
Arbitrary properties can be set with a properties element in a pom.xml or settings.xml, or properties can be loaded from external files.
No comments:
Post a Comment