3

How can I programmatically access Jenkins URL field that is configured through Manage Jenkins > Configure System > Jenkins Location?

I tried Computer.currentComputer().getUrl() but returns only computer/(master)/

4

2 に答える 2

7

これが私がそれを行うために使用する方法です:

JenkinsLocationConfiguration globalConfig = new JenkinsLocationConfiguration();
globalConfig.getUrl()
于 2013-04-11T13:55:30.313 に答える
3

他の回答のJenkinsLocationConfiguration クラスに加えて、 Jenkins.getInstance.getRootUrl()は構成された URL を返します。

Jenkins.getInstance.getRootUrlFromRequest()も確認してください。使用中の実際の URL が返されますが、リクエストの処理中のみです。

于 2013-04-11T19:02:05.153 に答える