English 中文(简体)
我如何在 java 中检索环境变量( Jenkins)?
原标题:How can I retrieve environment variables(Jenkins) in java

我通过 Jenkins 建筑的预建步骤中的一些窗口批量命令设置一些环境变量。 我需要使用这些变量来测试几例java 测试案例, 这些测试案例将作为建筑的一部分运行 。

set HD_KF_TC_IN_LOOK_UP_KET_FEATURE_XLS = %WORKSPACE%selenium_input_filesKey_Featuresen_US

我试图通过使用 System.getenv (HD_KF_TC_IN_LOOK_UP_KET_FEAturE_XLS) 命令检索这些环境变量值。 但这不是有效的, 因为这些变量的值总是 NULLL

请告诉我我哪里错了?

最佳回答

正如我在评论中指出的,我并不完全理解你的设置。 但是, 一般来说, 詹金斯 建设一步中设置的环境变量不会在外传播, 无法从其他建设步骤中访问 。 您需要使用 < a href=" https://wiki.jenkins- ci. org/ display/ JENKINS/ EnvInject+Plugin" rel = “ nofollow" > EnvInject 插件 来实现这一目标 。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签