InterviewSolution
| 1. |
What are user-defined properties? |
|
Answer» You have the opportunity to DEFINE your own ARBITRARY properties in addition to the implicit properties. A POM or a Profile can be used to define properties. The properties defined in a POM or a Maven Profile can be referenced in Maven just like any other property. User-defined properties can be used to filter resources via the Maven Resource plugin, or they can be referenced in a POM. In a Maven POM, here's an example of defining some arbitrary properties. <project> ... <properties> <arbitrary.property.x>Text</arbitrary.property.x> <hibernate.version>3.2.1.ga</hibernate.version> </properties> ... <DEPENDENCIES> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>${hibernate.version}</version> </dependency> </dependencies> ...</project>arbitrary.property.x and hibernate.version are two properties defined in the preceding example. In a dependency declaration, hibernate.version is mentioned. It's usual practice in Maven POMs and Profiles to USE the period character as a separator in property names. The following example demonstrates how to define a property in a Maven POM profile. <project> ... <profiles> <profile> <id>random-profile</id> <properties> <arbitrary.property>Text</arbitrary.property> </properties> </profile> </profiles> ...</project> |
|