Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[FIXED JENKINS-8663] Flag -U is not used during the parsing step of a

Maven Job

If the -U flag is specified in the goals/options of the build step of a
Maven job, it should be used as well in the parsing step.
  • Loading branch information...
commit 1421ca15d5a36706214476e613eeab789b9066df 1 parent 0f08dc0
Vincent Latombe Vlatombe authored
3  changelog.html
View
@@ -56,6 +56,9 @@
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
+ Flag -U is not used during the parsing step of a Maven Job
+ (<a href="https://issues.jenkins-ci.org/browse/JENKINS-8663">issue 8663</a>)
+ <li class=bug>
Custom workspace validation not working.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13404">issue 13404</a>)
</ul>
14 maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java
View
@@ -83,6 +83,11 @@
* @since 1.426
*/
private File globalSettings;
+
+ /**
+ * @since 1.461
+ */
+ private boolean updateSnapshots;
/**
* @param listener
@@ -224,4 +229,13 @@ public MavenEmbedderRequest setGlobalSettings( File globalSettings ) {
this.globalSettings = globalSettings;
return this;
}
+
+ public MavenEmbedderRequest setUpdateSnapshots(boolean updateSnapshots) {
+ this.updateSnapshots = updateSnapshots;
+ return this;
+ }
+
+ public boolean isUpdateSnapshots() {
+ return updateSnapshots;
+ }
}
8 maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
View
@@ -1069,6 +1069,8 @@ public Exception getCause() {
private int mavenValidationLevel = -1;
+ private boolean updateSnapshots = false;
+
String rootPOMRelPrefix;
public PomParser(BuildListener listener, MavenInstallation mavenHome, String mavenVersion, EnvVars envVars, MavenModuleSetBuild build) {
@@ -1079,6 +1081,7 @@ public PomParser(BuildListener listener, MavenInstallation mavenHome, String mav
this.rootPOM = project.getRootPOM();
this.profiles = project.getProfiles();
this.properties = project.getMavenProperties();
+ this.updateSnapshots = isUpdateSnapshots(project.getGoals());
ParametersDefinitionProperty parametersDefinitionProperty = project.getProperty( ParametersDefinitionProperty.class );
if (parametersDefinitionProperty != null && parametersDefinitionProperty.getParameterDefinitions() != null) {
for (ParameterDefinition parameterDefinition : parametersDefinitionProperty.getParameterDefinitions()) {
@@ -1121,6 +1124,10 @@ public PomParser(BuildListener listener, MavenInstallation mavenHome, String mav
}
+ private boolean isUpdateSnapshots(String goals) {
+ return StringUtils.contains(goals, "-U") || StringUtils.contains(goals, "--update-snapshots");
+ }
+
public List<PomInfo> invoke(File ws, VirtualChannel channel) throws IOException {
File pom;
@@ -1186,6 +1193,7 @@ public PomParser(BuildListener listener, MavenInstallation mavenHome, String mav
profiles, properties,
privateRepository, settingsLoc );
mavenEmbedderRequest.setTransferListener( new SimpleTransferListener(listener) );
+ mavenEmbedderRequest.setUpdateSnapshots( this.updateSnapshots );
mavenEmbedderRequest.setProcessPlugins( this.processPlugins );
mavenEmbedderRequest.setResolveDependencies( this.resolveDependencies );
2  maven-plugin/src/main/java/hudson/maven/MavenUtil.java
View
@@ -176,6 +176,8 @@ public static MavenEmbedder createEmbedder(MavenEmbedderRequest mavenEmbedderReq
mavenRequest.setWorkspaceReader( mavenEmbedderRequest.getWorkspaceReader() );
}
+ mavenRequest.setUpdateSnapshots(mavenEmbedderRequest.isUpdateSnapshots());
+
// TODO olamy check this sould be userProperties
mavenRequest.setSystemProperties(mavenEmbedderRequest.getSystemProperties());
Please sign in to comment.
Something went wrong with that request. Please try again.