Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Java by (10.2k points)
I am using maven as build tool. I have set an environment variable called env. How can I get access to this environment variable's value in the pom.xml file?

1 Answer

0 votes
by (46k points)

Check out the Maven Properties Guide...

As Seshagiri pointed out in the comments, ${env.VARIABLE_NAME} will do what you want.

I will add a word of warning and say that a pom.xml should completely describe your project so please use environment variables judiciously. If you make your builds dependent on your environment, they are harder to reproduce

Related questions

0 votes
1 answer
asked Jul 18, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...