Anna Lee
Anna Lee

Reputation: 951

how to know the value variable defined in pom.xml?

I have some multi-module Maven project, I am looking through whole pom.xml. I am beginner for Maven project, so not have enough knowledge to understand it comprehensively. There is some variable defined in pom.xml,

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>xxx</artifactId>
<version>${project.version}</version>
</dependency>

I searched whole properties defined in pom.xml cause those are that I know of which variable can be defined for pom.xml. Does anybody know about how I can figure I what the 'project.groupId' is? Is there any files or environments I can search for?

Upvotes: 2

Views: 3364

Answers (1)

Andreas Sewe
Andreas Sewe

Reputation: 1638

I searched whole properties defined in pom.xml cause those are that I know of which variable can be defined for pom.xml. Does anybody know about how I can figure I what the 'project.groupId' is? Is there any files or environments I can search for?

If you would like to explore the various properties, you may find the output of mvn help:expressions instructive; it lists the various starting points of such property expressions, e.g., ${project} (the current project’s POM) or ${settings} (the user’s settings).

You can then use mvn help:evaluate to explore the values of these properties. For example, if you enter ${project} on evaluate’s prompt, you will see an XML rendition of the ${project} object. Within this XML element, you can select child elements by a dot-separated path. A property like ${project.build.finalName} will evaluate to to the value of the <project> > <build> > <finalName> element.

Upvotes: 3

Related Questions