From 90f360cb442b08f341cb459e5cbf04babaab1181 Mon Sep 17 00:00:00 2001 From: Daniel Beck Date: Fri, 8 Mar 2024 09:09:27 +0100 Subject: [PATCH] Deprecate standalone use of `hudson.Main` --- core/src/main/java/hudson/Main.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/Main.java b/core/src/main/java/hudson/Main.java index 97bd9dfa8471..f774e68a8259 100644 --- a/core/src/main/java/hudson/Main.java +++ b/core/src/main/java/hudson/Main.java @@ -57,7 +57,11 @@ */ public class Main { - /** @see #remotePost */ + /** + * @see #remotePost + * @deprecated Scheduled for removal in mid 2024. + * */ + @Deprecated public static void main(String[] args) { try { System.exit(run(args)); @@ -67,8 +71,16 @@ public static void main(String[] args) { } } - /** @see #remotePost */ + /** + * @see #remotePost + * @deprecated Scheduled for removal in mid 2024. + * */ + @Deprecated public static int run(String[] args) throws Exception { + System.err.println("Running `java -jar jenkins-core.jar …` has been deprecated and will be removed in a future release."); + System.err.println("Use `java -jar jenkins-cli.jar set-external-build-result …` instead."); + System.err.println("See JENKINS-70684 for more information."); + String home = getHudsonHome(); if (home == null) { System.err.println("JENKINS_HOME is not set."); @@ -91,7 +103,9 @@ private static String getHudsonHome() { /** * Run command and send result to {@code ExternalJob} in the {@code external-monitor-job} plugin. * Obsoleted by {@code SetExternalBuildResultCommand} but kept here for compatibility. + * @deprecated Scheduled for removal in mid 2024. */ + @Deprecated public static int remotePost(String[] args) throws Exception { String projectName = args[0]; @@ -233,6 +247,8 @@ private static HttpURLConnection open(URL url) throws IOException { /** * Time out for socket connection to Hudson. + * @deprecated Scheduled for removal in mid 2024. */ + @Deprecated public static final int TIMEOUT = SystemProperties.getInteger(Main.class.getName() + ".timeout", 15000); }