public abstract class AbstractHpiMojo extends AbstractJenkinsMojo
| Modifier and Type | Field and Description |
|---|---|
protected org.codehaus.plexus.archiver.manager.ArchiverManager |
archiverManager
To look up Archiver/UnArchiver implementations
|
protected boolean |
failOnVersionOverrideToDifferentRelease
Controls the safety check that prevents a
snapshotPluginVersionOverride from switching to a different
release version. |
protected String |
globalMaskClasses
Like the
maskClasses parameter, but it applies at the boundary between core and
all the plugins. |
protected String |
maskClasses
[ws|tab|CR|LF]+ separated list of package prefixes that your plugin doesn't want to see
from the core.
|
protected String |
outputDirectory
The directory for the generated WAR.
|
protected boolean |
pluginFirstClassLoader
Change the classloader preference such that classes locally bundled in this plugin
will take precedence over those that are defined by the dependency plugins.
|
protected String |
pluginName
Name of the plugin that Jenkins uses for display purpose.
|
protected String |
pluginVersionDescription
Additional information that accompanies the version number of the plugin.
|
protected String |
snapshotPluginVersionOverride
Optional - the version to use in place of the project version in the event that the project version is a
-SNAPSHOT.
|
protected File |
warSourceDirectory
Single directory for extra files to include in the WAR.
|
artifactFactory, artifactResolver, jenkinsCoreId, project, projectBuilder, projectHelper, session| Constructor and Description |
|---|
AbstractHpiMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildExplodedWebapp(File webappDirectory,
File jarFile) |
void |
buildWebapp(org.apache.maven.project.MavenProject project,
File webappDirectory)
Builds the webapp for the specified project.
|
void |
copyResources(File sourceDirectory,
File webappDirectory)
Copies webapp webResources from the specified directory.
|
void |
copyResources(org.apache.maven.model.Resource resource,
File webappDirectory,
Properties filterProperties)
Copies webapp webResources from the specified directory.
|
File |
getClassesDirectory() |
File |
getContainerConfigXML() |
protected String[] |
getDependentWarExcludes()
Returns a string array of the excludes to be used
when adding dependent wars as an overlay onto this war.
|
protected String[] |
getDependentWarIncludes()
Returns a string array of the includes to be used
when adding dependent wars as an overlay onto this war.
|
Set<MavenArtifact> |
getDirectDependencyArtfacts()
Returns just the direct dependencies.
|
protected String[] |
getExcludes()
Returns a string array of the excludes to be used
when assembling/copying the war.
|
String |
getGitHeadSha1()
If the project is on Git, figure out Git SHA1.
|
protected String[] |
getIncludes()
Returns a string array of the includes to be used
when assembling/copying the war.
|
Set<MavenArtifact> |
getProjectArtfacts()
Returns all the transitive dependencies.
|
File |
getWebappDirectory() |
protected Boolean |
isSupportDynamicLoading()
Is the dynamic loading supported?
False, if the answer is known to be "No".
|
void |
setClassesDirectory(File classesDirectory) |
void |
setContainerConfigXML(File containerConfigXML) |
void |
setWarSourceDirectory(File warSourceDirectory) |
void |
setWebappDirectory(File webappDirectory) |
protected Set<MavenArtifact> |
wrap(Iterable<org.apache.maven.artifact.Artifact> artifacts) |
findJenkinsVersion, wrapgetLog, getPluginContext, setLog, setPluginContext@Parameter(defaultValue="${project.build.directory}")
protected String outputDirectory
@Parameter(defaultValue="${project.name}",
readonly=true)
protected String pluginName
@Parameter(defaultValue="${plugin.version.description}")
protected String pluginVersionDescription
@Parameter protected String snapshotPluginVersionOverride
-SNAPSHOT, for example if the project version is 1.2.3-SNAPSHOT then the
snapshotPluginVersionOverride could be 1.2.3-rc45.cafebabe-SNAPSHOT or
1.2.3-20180430.123233-56, etc, but it could not be 1.2.4 as that does not start with the
project version.
When testing plugin builds on a locally hosted update centre, in order to be allowed to update the plugin,
the update centre must report the plugin version as greater than the currently installed plugin version.
If you are using a Continuous Delivery model for your plugin (i.e. where the master branch stays on a
version like 1.x-SNAPSHOT and releases are tagged but not merged back to master (in order to
prevent merge conflicts) then you will find that you cannot update the plugin when building locally as
1.x-SNAPSHOT is never less than 1.x-SNAPSHOT. Thus in order to test plugin upgrade (in say
an acceptance test), you need to override the plugin version for non-releases. Typically you would use
something like git-timestamp-maven-plugin
to populate a property with the version and then use this configuration to provide the version.failOnVersionOverrideToDifferentRelease@Parameter(defaultValue="true") protected boolean failOnVersionOverrideToDifferentRelease
snapshotPluginVersionOverride from switching to a different
release version.@Parameter(defaultValue="${basedir}/src/main/webapp")
protected File warSourceDirectory
@Component protected org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
@Parameter protected String maskClasses
Tokens in this list is prefix-matched against the fully-qualified class name, so add "." to the end of each package name, like "com.foo. com.bar."
@Parameter protected String globalMaskClasses
maskClasses parameter, but it applies at the boundary between core and
all the plugins.
This mechanism is intended for those plugins that bring JavaEE APIs (such as the database plugin, which brings in the JPA API.) Other plugins that depend on the database plugin can still see the JPA API through the container classloader, so to make them all resolve to the JPA API in the database plugin, the database plugin needs to rely on this mechanism.
@Parameter protected boolean pluginFirstClassLoader
This is useful if the plugins that you want to depend on exposes conflicting versions of the libraries you are using, but enabling this switch makes your code susceptible to classloader constraint violations.
public File getClassesDirectory()
public void setClassesDirectory(File classesDirectory)
public File getWebappDirectory()
public void setWebappDirectory(File webappDirectory)
public void setWarSourceDirectory(File warSourceDirectory)
public File getContainerConfigXML()
public void setContainerConfigXML(File containerConfigXML)
protected String[] getExcludes()
protected String[] getIncludes()
protected String[] getDependentWarExcludes()
protected String[] getDependentWarIncludes()
public void buildExplodedWebapp(File webappDirectory, File jarFile) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionpublic void copyResources(org.apache.maven.model.Resource resource,
File webappDirectory,
Properties filterProperties)
throws IOException
Note that the webXml parameter could be null and may
specify a file which is not named web.xml. If the file
exists, it will be copied to the META-INF directory and
renamed accordingly.
resource - the resource to copywebappDirectory - the target directoryIOException - if an error occurred while copying webResourcespublic void copyResources(File sourceDirectory, File webappDirectory) throws IOException
Note that the webXml parameter could be null and may
specify a file which is not named web.xml. If the file
exists, it will be copied to the META-INF directory and
renamed accordingly.
sourceDirectory - the source directorywebappDirectory - the target directoryIOException - if an error occurred while copying webResourcespublic Set<MavenArtifact> getProjectArtfacts()
public Set<MavenArtifact> getDirectDependencyArtfacts()
protected Set<MavenArtifact> wrap(Iterable<org.apache.maven.artifact.Artifact> artifacts)
public void buildWebapp(org.apache.maven.project.MavenProject project,
File webappDirectory)
throws org.apache.maven.plugin.MojoExecutionException,
IOException
Classes, libraries and tld files are copied to
the webappDirectory during this phase.
project - the maven projectIOException - if an error occurred while building the webapporg.apache.maven.plugin.MojoExecutionExceptionpublic String getGitHeadSha1()
protected Boolean isSupportDynamicLoading() throws IOException
IOExceptionCopyright © 2004–2022. All rights reserved.