I'm trying to use Jenkins CLI to install a Jenkins plugin with command:
java -jar jenkins-cli.jar -s http://localhost:8080 -auth @cred install-plugin https://updates.jenkins.io/download/plugins/htmlpublisher/1.31/htmlpublisher.hpi
and got the error
Installing a plugin from https://updates.jenkins.io/download/plugins/htmlpublisher/1.31/htmlpublisher.hpi
ERROR: Unexpected exception occurred while performing install-plugin command.
java.net.UnknownHostException: updates.jenkins.io
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:305)
at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:507)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:373)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:207)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:193)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
at java.base/java.net.URL.openStream(URL.java:1165)
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1068)
at hudson.cli.InstallPluginCommand.run(InstallPluginCommand.java:110)
at hudson.cli.CLICommand.main(CLICommand.java:251)
at hudson.cli.CLIAction$ServerSideImpl.run(CLIAction.java:299)
at hudson.cli.CLIAction$1.lambda$opened$0(CLIAction.java:154)
at java.base/java.lang.Thread.run(Thread.java:829)
What I have tried out:
Jenkins version: Jenkins 2.401.2
Appreciate for your help.
You can also try to directly download the hpi file and install it:
A logged-in Jenkins administrator may upload the file from within the web UI: