Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make easier to pass build and runtime environment variables #282

Open
yersan opened this issue Nov 3, 2021 · 0 comments
Open

Make easier to pass build and runtime environment variables #282

yersan opened this issue Nov 3, 2021 · 0 comments

Comments

@yersan
Copy link

yersan commented Nov 3, 2021

Right now we can pass build time environment variables appending them with -D to the maven goal. For example If I am using a feature pack that requires configurations via environment variables (e.g. eap-datasources-galleon-pack) I can just run mvn package -Dmy.feature.pack.variable=value

If I additionally need to pass runtime variables to the server, then I can use the following:

mvn package wildfly-jar:run \
-Dmy.feature.pack.variable=value \
-Dwildfly.bootable.jvmArguments='-Dmy.runtime.variable=value'

Maybe an easier approach could be to pass these sort of variables via maven plugin configuration. That will allow the developer to keep the configuration on the pom.xml by default instead of supplying the values externally. It will also allow the developer to think in just maven environment variables with the possibility to turn out the previous command in something like this to override any default:

mvn package wildfly-jar:run \
-Doverride.default.pom.my.feature.pack.variable=value \
-Doverride.default.pom.my.runtime.variable=value

The plugin configuration could read the command line environment variables by using:

<configuration>
  <build-env>
      <my.feature.pack.variable>${override.default.pom.my.feature.pack.variable}</my.feature.pack.variable>
  </build-env>
  <env>
     <my.runtime.variable>${override.default.pom.my.runtime.variable}</my.runtime.variable>
  </env>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant