diff --git a/core/src/main/java/hudson/maven/MavenModule.java b/core/src/main/java/hudson/maven/MavenModule.java index 8be6380318..82248f9ebb 100644 --- a/core/src/main/java/hudson/maven/MavenModule.java +++ b/core/src/main/java/hudson/maven/MavenModule.java @@ -247,7 +247,18 @@ public final class MavenModule extends AbstractMavenProject + * Much of Hudson assumes that the build number is unique and monotonic, + * so this method can only accept a new value that's bigger than + * {@link #getNextBuildNumber()} returns. Otherwise it'll be no-op. + * + * @since 1.199 + * (before that, this method was package private.) + */ + public void updateNextBuildNumber(int next) throws IOException { if(next>nextBuildNumber) { this.nextBuildNumber = next; saveNextBuildNumber(); diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java index 3eff1b3720..238eb87106 100644 --- a/core/src/main/java/hudson/model/Job.java +++ b/core/src/main/java/hudson/model/Job.java @@ -201,6 +201,24 @@ public abstract class Job, RunT extends Run + * Much of Hudson assumes that the build number is unique and monotonic, + * so this method can only accept a new value that's bigger than + * {@link #getNextBuildNumber()} returns. Otherwise it'll be no-op. + * + * @since 1.199 + * (before that, this method was package private.) + */ + public void updateNextBuildNumber(int next) throws IOException { + if(next>nextBuildNumber) { + this.nextBuildNumber = next; + saveNextBuildNumber(); + } + } + /** * Returns the log rotator for this job, or null if none. */