Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[FIXED JENKINS-15977] ClassNotFound is maven plugin not installed
Check for the maven plugin being installed before trying to see if the project src is a maven project.
- Loading branch information
Showing
with
8 additions
and 5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -195,7 +195,8 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListene | ||
// for backward compatibility, look up the copier as CopyMethod | ||
Copier copier = Copier.from(Jenkins.getInstance().getExtensionList(CopyMethod.class).get(0)).clone(); | ||
|
||
if (Hudson.getInstance().getPlugin("maven-plugin") != null && (src instanceof MavenModuleSetBuild) ) { | ||
This comment has been minimized.
This comment has been minimized.
ikedam
Member
|
||
// use classes in the "maven-plugin" plugin as might not be installed | ||
// Copy artifacts from the build (ArchiveArtifacts build step) | ||
boolean ok = perform(src, build, expandedFilter, targetDir, baseTargetDir, copier, console); | ||
// Copy artifacts from all modules of this Maven build (automatic archiving) | ||
@@ -347,11 +348,13 @@ public FormValidation doCheckProjectName( | ||
FormValidation result; | ||
Item item = new JobResolver(anc.getParent(),value).job; | ||
if (item != null) | ||
if (Hudson.getInstance().getPlugin("maven-plugin") != null && item instanceof MavenModuleSet) { | ||
result = FormValidation.warning(Messages.CopyArtifact_MavenProject()); | ||
} else { | ||
result = (item instanceof MatrixProject) | ||
? FormValidation.warning(Messages.CopyArtifact_MatrixProject()) | ||
: FormValidation.ok(); | ||
} | ||
else if (value.indexOf('$') >= 0) | ||
result = FormValidation.warning(Messages.CopyArtifact_ParameterizedName()); | ||
else | ||
I think you also have to check whether the plugin is active, just because the plugin is installed, does not mean its classes are available...
Hudson.getInstance().getPlugin("maven-plugin").getWrapper().isEnabled()
beware of NPE...