How to pass environment variables to Maven on command line?

Asked

Viewed 139 times

0

I want to pass values of environment variables to Maven via command line.
How to do?

Attempts:

  • mvn liquibase:update -Dliquibase.url=$DB_URL: Maven executes, but the value is not passed

  • mvn liquibase:update -Dliquibase.url=${DB_URL}: Maven executes, but the value is not passed

  • mvn liquibase:update -Dliquibase.url=${env.DB_URL}: bash error:

-bash: -Dliquibase.url=${env.DB_URL}: bad substitution

  • 1

    The first and second methods are equivalent, and I can’t imagine why they didn’t work

  • @Jeffersonquesado I think is right. The problem is when the base connect to the bank. It is not passing the user. I thought it was a call problem but it’s not. I’ll answer

1 answer

1


My fault.

The command mvn liquibase:update -Dliquibase.url=$DB_URL works.
I thought it did not work because Liquibase was not receiving the parameters, but it is for another problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.