# Inject environment variable from custom plugin

**URL:** <https://community.jenkins.io/t/inject-environment-variable-from-custom-plugin/7286>\
**Category:** Code\
**Created:** [May 10, 2023, 2:58pm UTC](https://community.jenkins.io/t/inject-environment-variable-from-custom-plugin/7286 "2023-05-10T14:58:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohanisch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mohanisch/32/2470_2.png) [@mohanisch](https://community.jenkins.io/u/mohanisch)\
**Post date:** [May 10, 2023, 2:58pm UTC](https://community.jenkins.io/t/inject-environment-variable-from-custom-plugin/7286/1 "2023-05-10T14:58:53Z")

</div>

Hello!

We use a self-written plugin to standardize Gradle builds. If necessary, small modifications are made to settings.gradle during runtime. This happens in the SCMListener by extending it.

Now we are also looking for a solution how to inject credentials as environment variable.  
Using this doc ([Build (Jenkins core 2.404 API)](https://javadoc.jenkins-ci.org/hudson/model/Build.html)) we have already tried to solve this in the BuildWrapper via ProcessBuilder, so far no success…

Is there any solution for that?

Thanks  
Marco

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [May 16, 2023, 9:23am UTC](https://community.jenkins.io/t/inject-environment-variable-from-custom-plugin/7286/2 "2023-05-16T09:23:28Z")

</div>

Hello @mohanisch and welcome back 👋

Have you thought of using [Credentials Binding](https://plugins.jenkins.io/credentials-binding/) ?
