Skip to content

Commit

Permalink
[JENKINS-41196] config flag for core component override.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Sep 2, 2017
1 parent 40867ff commit 8d3e655
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java
Expand Up @@ -228,6 +228,13 @@ public abstract class AbstractHpiMojo extends AbstractJenkinsMojo {
@Parameter
protected boolean pluginFirstClassLoader = false;

/**
* True if this is a plugin that overrides a core component.
* See https://issues.jenkins-ci.org/browse/JENKINS-41196
*/
@Parameter
protected boolean coreComponent = false;

/**
* If true, test scope dependencies count as if they are normal dependencies.
* This is only useful during hpi:run, so not exposing it as a configurable parameter.
Expand Down Expand Up @@ -977,6 +984,9 @@ protected void setAttributes(Section mainSection) throws MojoExecutionException,
Boolean b = isSupportDynamicLoading();
if (b!=null)
mainSection.addAttributeAndCheck(new Attribute("Support-Dynamic-Loading",b.toString()));

if (coreComponent)
mainSection.addAttributeAndCheck(new Attribute("Core-Component","true"));
}

/**
Expand All @@ -986,6 +996,10 @@ protected void setAttributes(Section mainSection) throws MojoExecutionException,
* we don't know we can dynamic load. Otherwise, if everything is known to be dynamic loadable, return true.
*/
protected Boolean isSupportDynamicLoading() throws IOException {
if (coreComponent) {
return false;
}

URLClassLoader cl = new URLClassLoader(new URL[]{
new File(project.getBuild().getOutputDirectory()).toURI().toURL()
}, getClass().getClassLoader());
Expand Down

0 comments on commit 8d3e655

Please sign in to comment.