diff --git a/pom.xml b/pom.xml index 28af1e71..b2cdb08e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.jenkins-ci.plugins plugin - 1.442 + 1.488 Jenkins Maven Release Plug-in Plug-in diff --git a/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java index fb7f5946..b2587ca9 100644 --- a/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java +++ b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java @@ -71,12 +71,14 @@ public class M2ReleaseAction implements PermalinkProjectAction { private boolean selectCustomScmTag = false; private boolean selectAppendHudsonUsername; private boolean selectScmCredentials; + private boolean selectSubmoduleRelease; - public M2ReleaseAction(MavenModuleSet project, boolean selectCustomScmCommentPrefix, boolean selectAppendHudsonUsername, boolean selectScmCredentials) { + public M2ReleaseAction(MavenModuleSet project, boolean selectCustomScmCommentPrefix, boolean selectAppendHudsonUsername, boolean selectScmCredentials, boolean selectSubmoduleRelease) { this.project = project; this.selectCustomScmCommentPrefix = selectCustomScmCommentPrefix; this.selectAppendHudsonUsername = selectAppendHudsonUsername; this.selectScmCredentials = selectScmCredentials; + this.selectSubmoduleRelease = selectSubmoduleRelease; if (getRootModule() == null) { // if the root module is not available, the user should be informed // about the stuff we are not able to compute @@ -133,6 +135,14 @@ public void setSelectAppendHudsonUsername(boolean selectAppendHudsonUsername) { this.selectAppendHudsonUsername = selectAppendHudsonUsername; } + public boolean isSelectSubmoduleRelease() { + return selectSubmoduleRelease; + } + + public void setSelectSubmoduleRelease(boolean selectSubmoduleRelease) { + this.selectSubmoduleRelease = selectSubmoduleRelease; + } + public boolean isSelectCustomScmTag() { return selectCustomScmTag; } @@ -217,6 +227,8 @@ public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOExceptio final String scmCommentPrefix = specifyScmCommentPrefix ? getString("scmCommentPrefix", httpParams) : null; //$NON-NLS-1$ final boolean specifyScmTag = httpParams.containsKey("specifyScmTag"); //$NON-NLS-1$ final String scmTag = specifyScmTag ? getString("scmTag", httpParams) : null; //$NON-NLS-1$ + final boolean submoduleRelease = httpParams.containsKey("submoduleRelease"); //$NON-NLS-1$ + final String submodules = submoduleRelease ? getString("submodules", httpParams) : null; //$NON-NLS-1$ final boolean appendHusonUserName = specifyScmCommentPrefix && httpParams.containsKey("appendHudsonUserName"); //$NON-NLS-1$ final boolean isDryRun = httpParams.containsKey("isDryRun"); //$NON-NLS-1$ @@ -278,6 +290,7 @@ public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOExceptio arguments.setScmUsername(scmUsername); arguments.setScmPassword(scmPassword); arguments.setScmTagName(scmTag); + arguments.setSubmodules(submodules); arguments.setScmCommentPrefix(scmCommentPrefix); arguments.setAppendHusonUserName(appendHusonUserName); arguments.setHudsonUserName(Hudson.getAuthentication().getName()); diff --git a/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseArgumentsAction.java b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseArgumentsAction.java index b5aeccde..d7b682b9 100644 --- a/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseArgumentsAction.java +++ b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseArgumentsAction.java @@ -59,6 +59,7 @@ public class M2ReleaseArgumentsAction implements Action { private transient String scmPassword; private transient String scmCommentPrefix; private String scmTagName; + private String submodules; private transient boolean appendHusonUserName; private transient String hudsonUserName; @@ -186,4 +187,12 @@ public void setHudsonUserName(String hudsonUserName) { this.hudsonUserName = hudsonUserName; } + public String getSubmodules() { + return submodules; + } + + public void setSubmodules(String submodules) { + this.submodules = submodules; + } + } diff --git a/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java index eb5b3345..4e6a69df 100644 --- a/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java +++ b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java @@ -99,6 +99,7 @@ public class M2ReleaseBuildWrapper extends BuildWrapper { public boolean selectCustomScmCommentPrefix = DescriptorImpl.DEFAULT_SELECT_CUSTOM_SCM_COMMENT_PREFIX; public boolean selectAppendHudsonUsername = DescriptorImpl.DEFAULT_SELECT_APPEND_HUDSON_USERNAME; public boolean selectScmCredentials = DescriptorImpl.DEFAULT_SELECT_SCM_CREDENTIALS; + public boolean selectSubmodules = DescriptorImpl.DEFAULT_SELECT_SUBMODULES; public int numberOfReleaseBuildsToKeep = DescriptorImpl.DEFAULT_NUMBER_OF_RELEASE_BUILDS_TO_KEEP; @@ -163,6 +164,10 @@ public void buildEnvVars(Map env) { if (args.getScmTagName() != null) { buildGoals.append("-Dtag=").append(args.getScmTagName()).append(' '); } + + if (args.getSubmodules() != null) { + buildGoals.append("--projects ").append(args.getSubmodules()).append(' '); + } if (args.isDryRun()) { buildGoals.append(getDryRunGoals()); @@ -373,7 +378,7 @@ private Object readResolve() { @Override public Action getProjectAction(@SuppressWarnings("rawtypes") AbstractProject job) { - return new M2ReleaseAction((MavenModuleSet) job, selectCustomScmCommentPrefix, selectAppendHudsonUsername, selectScmCredentials); + return new M2ReleaseAction((MavenModuleSet) job, selectCustomScmCommentPrefix, selectAppendHudsonUsername, selectScmCredentials, selectSubmodules); } /** @@ -465,6 +470,7 @@ public static class DescriptorImpl extends BuildWrapperDescriptor { public static final boolean DEFAULT_SELECT_CUSTOM_SCM_COMMENT_PREFIX = false; public static final boolean DEFAULT_SELECT_APPEND_HUDSON_USERNAME = false; public static final boolean DEFAULT_SELECT_SCM_CREDENTIALS = false; + public static final boolean DEFAULT_SELECT_SUBMODULES = false; public static final int DEFAULT_NUMBER_OF_RELEASE_BUILDS_TO_KEEP = 1; diff --git a/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly b/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly index 31cadf0e..8617ffa8 100644 --- a/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly +++ b/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly @@ -44,6 +44,12 @@ + + + + + + diff --git a/src/main/webapp/help-actionRelease-specifySubmodule.html b/src/main/webapp/help-actionRelease-specifySubmodule.html new file mode 100644 index 00000000..8d7bf233 --- /dev/null +++ b/src/main/webapp/help-actionRelease-specifySubmodule.html @@ -0,0 +1,6 @@ +
+ Enable this option to manually select which sub modules you want to release. If you want to release multiple modules at once, separate them with ','. + By default all modules are released. +

Example:

+

org.example.group:artifact1,org.example.group:artifact2

+

\ No newline at end of file