-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove use of Plexus Component Descriptor XML (#505)
- Loading branch information
Showing
11 changed files
with
234 additions
and
140 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...java/org/jenkinsci/maven/plugins/hpi/extensions/AbstractJenkinsModuleArtifactHandler.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import org.apache.maven.artifact.handler.DefaultArtifactHandler; | ||
|
||
public abstract class AbstractJenkinsModuleArtifactHandler extends DefaultArtifactHandler { | ||
protected AbstractJenkinsModuleArtifactHandler() { | ||
super("jenkins-module"); | ||
setExtension("jm"); | ||
setLanguage("java"); | ||
setAddedToClasspath(true); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...jenkinsci/maven/plugins/hpi/extensions/AbstractJenkinsModuleLifecycleMappingProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import java.util.Map; | ||
import org.apache.maven.lifecycle.mapping.LifecyclePhase; | ||
|
||
public abstract class AbstractJenkinsModuleLifecycleMappingProvider extends AbstractLifecycleMappingProvider { | ||
private static Map<String, LifecyclePhase> getBindings() { | ||
Map<String, LifecyclePhase> bindings = HpiLifecycleMappingProvider.getBindings(); | ||
bindings.remove("validate"); | ||
bindings.remove("process-test-classes"); | ||
return bindings; | ||
} | ||
|
||
protected AbstractJenkinsModuleLifecycleMappingProvider() { | ||
super(getBindings()); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...ain/java/org/jenkinsci/maven/plugins/hpi/extensions/AbstractLifecycleMappingProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import javax.inject.Provider; | ||
import org.apache.maven.lifecycle.mapping.Lifecycle; | ||
import org.apache.maven.lifecycle.mapping.LifecycleMapping; | ||
import org.apache.maven.lifecycle.mapping.LifecyclePhase; | ||
|
||
/** | ||
* Base lifecycle provider | ||
*/ | ||
public abstract class AbstractLifecycleMappingProvider implements Provider<LifecycleMapping> { | ||
private static final String DEFAULT_LIFECYCLE_KEY = "default"; | ||
|
||
private final Lifecycle defaultLifecycle; | ||
private final LifecycleMapping lifecycleMapping; | ||
|
||
protected AbstractLifecycleMappingProvider(Map<String, LifecyclePhase> bindings) { | ||
defaultLifecycle = new Lifecycle(); | ||
defaultLifecycle.setId(DEFAULT_LIFECYCLE_KEY); | ||
defaultLifecycle.setLifecyclePhases(bindings); | ||
|
||
lifecycleMapping = new DefaultLifecycleMapping(defaultLifecycle); | ||
} | ||
|
||
@Override | ||
public LifecycleMapping get() { | ||
return lifecycleMapping; | ||
} | ||
|
||
private static class DefaultLifecycleMapping implements LifecycleMapping { | ||
private final Lifecycle lifecycle; | ||
|
||
DefaultLifecycleMapping(Lifecycle lifecycle) { | ||
this.lifecycle = lifecycle; | ||
} | ||
|
||
@Override | ||
public Map<String, Lifecycle> getLifecycles() { | ||
return Map.of(DEFAULT_LIFECYCLE_KEY, lifecycle); | ||
} | ||
|
||
@Deprecated | ||
@Override | ||
public List<String> getOptionalMojos(String lifecycle) { | ||
return null; | ||
} | ||
|
||
@Deprecated | ||
@Override | ||
public Map<String, String> getPhases(String lifecycle) { | ||
if (DEFAULT_LIFECYCLE_KEY.equals(lifecycle)) { | ||
return this.lifecycle.getPhases(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/jenkinsci/maven/plugins/hpi/extensions/ExecutableWarArtifactHandler.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
import org.apache.maven.artifact.handler.DefaultArtifactHandler; | ||
|
||
/** | ||
* Executable WAR artifact handler | ||
* | ||
* <p>See JENKINS-24064 for background; used to be {@code war-for-test} classifier | ||
*/ | ||
@Named("executable-war") | ||
@Singleton | ||
public class ExecutableWarArtifactHandler extends DefaultArtifactHandler { | ||
public ExecutableWarArtifactHandler() { | ||
super("executable-war"); | ||
setExtension("war"); | ||
setLanguage("java"); | ||
setAddedToClasspath(true); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/jenkinsci/maven/plugins/hpi/extensions/HpiArtifactHandler.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
import org.apache.maven.artifact.handler.DefaultArtifactHandler; | ||
|
||
/** | ||
* HPI artifact handler | ||
*/ | ||
@Named("hpi") | ||
@Singleton | ||
public class HpiArtifactHandler extends DefaultArtifactHandler { | ||
public HpiArtifactHandler() { | ||
super("hudson-plugin"); | ||
setExtension("hpi"); | ||
setLanguage("java"); | ||
setAddedToClasspath(true); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/org/jenkinsci/maven/plugins/hpi/extensions/HpiLifecycleMappingProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
import org.apache.maven.lifecycle.mapping.LifecyclePhase; | ||
|
||
/** | ||
* {@code hpi} packaging plugin bindings provider for {@code default} lifecycle | ||
*/ | ||
@Named("hpi") | ||
@Singleton | ||
public final class HpiLifecycleMappingProvider extends AbstractLifecycleMappingProvider { | ||
/** | ||
* Note: The current plugin does NOT have to have a version specified, as the version should be | ||
* specified in the effective POM (otherwise this lifecycle mapping would not be loaded at all). | ||
* Therefore, the version of the current plugin (in this case {@code maven-hpi-plugin}) is NEVER | ||
* considered and will come from the effective POM of the project using this plugin. | ||
* | ||
* <p>For all other versions, we use the version defined in the current Maven baseline. | ||
*/ | ||
static Map<String, LifecyclePhase> getBindings() { | ||
Map<String, LifecyclePhase> bindings = new LinkedHashMap<>(); | ||
bindings.put( | ||
"validate", | ||
new LifecyclePhase( | ||
"org.jenkins-ci.tools:maven-hpi-plugin:validate,org.jenkins-ci.tools:maven-hpi-plugin:validate-hpi")); | ||
bindings.put( | ||
"process-resources", | ||
new LifecyclePhase("org.apache.maven.plugins:maven-resources-plugin:2.6:resources")); | ||
bindings.put("compile", new LifecyclePhase("org.apache.maven.plugins:maven-compiler-plugin:3.1:compile")); | ||
bindings.put("process-classes", new LifecyclePhase("org.kohsuke:access-modifier-checker:1.31:enforce")); | ||
bindings.put("generate-test-sources", new LifecyclePhase("org.jenkins-ci.tools:maven-hpi-plugin:insert-test")); | ||
bindings.put( | ||
"process-test-resources", | ||
new LifecyclePhase("org.apache.maven.plugins:maven-resources-plugin:2.6:testResources")); | ||
bindings.put( | ||
"test-compile", | ||
new LifecyclePhase( | ||
"org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile,org.jenkins-ci.tools:maven-hpi-plugin:test-hpl,org.jenkins-ci.tools:maven-hpi-plugin:resolve-test-dependencies")); | ||
bindings.put("process-test-classes", new LifecyclePhase("org.jenkins-ci.tools:maven-hpi-plugin:test-runtime")); | ||
bindings.put("test", new LifecyclePhase("org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test")); | ||
bindings.put("package", new LifecyclePhase("org.jenkins-ci.tools:maven-hpi-plugin:hpi")); | ||
bindings.put("install", new LifecyclePhase("org.apache.maven.plugins:maven-install-plugin:2.4:install")); | ||
bindings.put("deploy", new LifecyclePhase("org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy")); | ||
return bindings; | ||
} | ||
|
||
public HpiLifecycleMappingProvider() { | ||
super(getBindings()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/org/jenkinsci/maven/plugins/hpi/extensions/JenkinsModuleArtifactHandler.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* Jenkins module artifact handler | ||
*/ | ||
@Named("jenkins-module") | ||
@Singleton | ||
public class JenkinsModuleArtifactHandler extends AbstractJenkinsModuleArtifactHandler {} |
13 changes: 13 additions & 0 deletions
13
...ava/org/jenkinsci/maven/plugins/hpi/extensions/JenkinsModuleLifecycleMappingProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* {@code jenkins-module} packaging plugin bindings provider for {@code default} lifecycle | ||
* | ||
* <p>No longer used in official components as of <a href="https://jenkins.io/jep/230">JEP-230</a> | ||
*/ | ||
@Named("jenkins-module") | ||
@Singleton | ||
public final class JenkinsModuleLifecycleMappingProvider extends AbstractJenkinsModuleLifecycleMappingProvider {} |
14 changes: 14 additions & 0 deletions
14
src/main/java/org/jenkinsci/maven/plugins/hpi/extensions/JmArtifactHandler.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* Like {@link JenkinsModuleArtifactHandler} but for backward compatibility | ||
* | ||
* @deprecated use {@link JenkinsModuleArtifactHandler} | ||
*/ | ||
@Deprecated | ||
@Named("jm") | ||
@Singleton | ||
public class JmArtifactHandler extends AbstractJenkinsModuleArtifactHandler {} |
14 changes: 14 additions & 0 deletions
14
src/main/java/org/jenkinsci/maven/plugins/hpi/extensions/JmLifecycleMappingProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.jenkinsci.maven.plugins.hpi.extensions; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* Like {@link JenkinsModuleLifecycleMappingProvider} but for backward compatibility | ||
* | ||
* @deprecated use {@link JenkinsModuleLifecycleMappingProvider} | ||
*/ | ||
@Deprecated | ||
@Named("jm") | ||
@Singleton | ||
public final class JmLifecycleMappingProvider extends AbstractJenkinsModuleLifecycleMappingProvider {} |
This file was deleted.
Oops, something went wrong.