org.jenkinsci.maven.plugins.hpi

## Class AbstractHpiMojo

- java.lang.Object
- - org.apache.maven.plugin.AbstractMojo
  - - org.jenkinsci.maven.plugins.hpi.AbstractJenkinsMojo
    - - org.jenkinsci.maven.plugins.hpi.AbstractHpiMojo

All Implemented Interfaces:
  org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

Direct Known Subclasses:
  HpiMojo, HplMojo, ListPluginDependenciesMojo, TestDependencyMojo

    public abstract class AbstractHpiMojo
    extends AbstractJenkinsMojo

### Field Summary

Fields
`protected org.codehaus.plexus.archiver.manager.ArchiverManager` `archiverManager` To look up Archiver/UnArchiver implementations
`protected java.lang.String` `globalMaskClasses` Like the `maskClasses` parameter, but it applies at the boundary between core and all the plugins.
`protected org.apache.maven.artifact.repository.ArtifactRepository` `localRepository`
`protected java.lang.String` `maskClasses` [ws|tab|CR|LF]+ separated list of package prefixes that your plugin doesn't want to see from the core.
`protected java.lang.String` `outputDirectory` The directory for the generated WAR.
`protected java.lang.String` `pluginName` Name of the plugin that Jenkins uses for display purpose.
`protected org.apache.maven.project.MavenProjectBuilder` `projectBuilder`
`protected java.io.File` `warSourceDirectory` Single directory for extra files to include in the WAR.

### Fields inherited from class org.jenkinsci.maven.plugins.hpi.AbstractJenkinsMojo

`jenkinsCoreId, project`

### Fields inherited from interface org.apache.maven.plugin.Mojo

`ROLE`

### Constructor Summary

Constructors
Constructor and Description
`AbstractHpiMojo()`

### Method Summary

Methods
`void` `buildExplodedWebapp(java.io.File webappDirectory)`
`void` `buildWebapp(org.apache.maven.project.MavenProject project, java.io.File webappDirectory)` Builds the webapp for the specified project.
`void` `copyResources(java.io.File sourceDirectory, java.io.File webappDirectory)` Copies webapp webResources from the specified directory.
`void` `copyResources(org.apache.maven.model.Resource resource, java.io.File webappDirectory, java.util.Properties filterProperties)` Copies webapp webResources from the specified directory.
`java.io.File` `getClassesDirectory()`
`java.io.File` `getContainerConfigXML()`
`protected java.lang.String[]` `getDependentWarExcludes()` Returns a string array of the excludes to be used when adding dependent wars as an overlay onto this war.
`protected java.lang.String[]` `getDependentWarIncludes()` Returns a string array of the includes to be used when adding dependent wars as an overlay onto this war.
`java.util.Set<MavenArtifact>` `getDirectDependencyArtfacts()` Returns all just the direct dependencies.
`protected java.lang.String[]` `getExcludes()` Returns a string array of the excludes to be used when assembling/copying the war.
`protected java.lang.String[]` `getIncludes()` Returns a string array of the includes to be used when assembling/copying the war.
`java.util.Set<MavenArtifact>` `getProjectArtfacts()` Returns all the transitive dependencies.
`java.io.File` `getWebappDirectory()`
`protected java.lang.Boolean` `isSupportDynamicLoading()` Is the dynamic loading supported? False, if the answer is known to be "No".
`protected void` `setAttributes(org.codehaus.plexus.archiver.jar.Manifest.Section mainSection)`
`void` `setClassesDirectory(java.io.File classesDirectory)`
`void` `setContainerConfigXML(java.io.File containerConfigXML)`
`void` `setWarSourceDirectory(java.io.File warSourceDirectory)`
`void` `setWebappDirectory(java.io.File webappDirectory)`
`protected MavenArtifact` `wrap(org.apache.maven.artifact.Artifact a)`
`protected java.util.Set<MavenArtifact>` `wrap(java.lang.Iterable<org.apache.maven.artifact.Artifact> artifacts)`

### Methods inherited from class org.jenkinsci.maven.plugins.hpi.AbstractJenkinsMojo

`findJenkinsVersion`

### Methods inherited from class org.apache.maven.plugin.AbstractMojo

`getLog, getPluginContext, setLog, setPluginContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.maven.plugin.Mojo

`execute`

### Field Detail

#### outputDirectory

    protected java.lang.String outputDirectory

The directory for the generated WAR.

#### pluginName

    protected java.lang.String pluginName

Name of the plugin that Jenkins uses for display purpose. It should be one line text.

#### warSourceDirectory

    protected java.io.File warSourceDirectory

Single directory for extra files to include in the WAR.

#### archiverManager

    protected org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager

To look up Archiver/UnArchiver implementations

#### maskClasses

    protected java.lang.String maskClasses

[ws|tab|CR|LF]+ separated list of package prefixes that your plugin doesn't want to see from the core.

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."

#### globalMaskClasses

    protected java.lang.String globalMaskClasses

Like the `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.

Since:
  1.92

#### projectBuilder

    protected org.apache.maven.project.MavenProjectBuilder projectBuilder

#### localRepository

    protected org.apache.maven.artifact.repository.ArtifactRepository localRepository

### Constructor Detail

#### AbstractHpiMojo

    public AbstractHpiMojo()

### Method Detail

#### getClassesDirectory

    public java.io.File getClassesDirectory()

#### setClassesDirectory

    public void setClassesDirectory(java.io.File classesDirectory)

#### getWebappDirectory

    public java.io.File getWebappDirectory()

#### setWebappDirectory

    public void setWebappDirectory(java.io.File webappDirectory)

#### setWarSourceDirectory

    public void setWarSourceDirectory(java.io.File warSourceDirectory)

#### getContainerConfigXML

    public java.io.File getContainerConfigXML()

#### setContainerConfigXML

    public void setContainerConfigXML(java.io.File containerConfigXML)

#### getExcludes

    protected java.lang.String[] getExcludes()

Returns a string array of the excludes to be used when assembling/copying the war.

Returns:
  an array of tokens to exclude

#### getIncludes

    protected java.lang.String[] getIncludes()

Returns a string array of the includes to be used when assembling/copying the war.

Returns:
  an array of tokens to include

#### getDependentWarExcludes

    protected java.lang.String[] getDependentWarExcludes()

Returns a string array of the excludes to be used when adding dependent wars as an overlay onto this war.

Returns:
  an array of tokens to exclude

#### getDependentWarIncludes

    protected java.lang.String[] getDependentWarIncludes()

Returns a string array of the includes to be used when adding dependent wars as an overlay onto this war.

Returns:
  an array of tokens to include

#### buildExplodedWebapp

    public void buildExplodedWebapp(java.io.File webappDirectory)
                             throws org.apache.maven.plugin.MojoExecutionException

Throws:
  `org.apache.maven.plugin.MojoExecutionException`

#### copyResources

    public void copyResources(org.apache.maven.model.Resource resource,
                     java.io.File webappDirectory,
                     java.util.Properties filterProperties)
                       throws java.io.IOException

Copies webapp webResources from the specified directory.

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.``

Parameters:
  `resource` - the resource to copy
  `webappDirectory` - the target directory
  `filterProperties` -
Throws:
  `java.io.IOException` - if an error occurred while copying webResources

#### copyResources

    public void copyResources(java.io.File sourceDirectory,
                     java.io.File webappDirectory)
                       throws java.io.IOException

Copies webapp webResources from the specified directory.

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.``

Parameters:
  `sourceDirectory` - the source directory
  `webappDirectory` - the target directory
Throws:
  `java.io.IOException` - if an error occurred while copying webResources

#### getProjectArtfacts

    public java.util.Set<MavenArtifact> getProjectArtfacts()

Returns all the transitive dependencies.

#### getDirectDependencyArtfacts

    public java.util.Set<MavenArtifact> getDirectDependencyArtfacts()

Returns all just the direct dependencies.

#### wrap

    protected java.util.Set<MavenArtifact> wrap(java.lang.Iterable<org.apache.maven.artifact.Artifact> artifacts)

#### wrap

    protected MavenArtifact wrap(org.apache.maven.artifact.Artifact a)

#### buildWebapp

    public void buildWebapp(org.apache.maven.project.MavenProject project,
                   java.io.File webappDirectory)
                     throws org.apache.maven.plugin.MojoExecutionException,
                            java.io.IOException

Builds the webapp for the specified project.

Classes, libraries and tld files are copied to the `webappDirectory` during this phase.

Parameters:
  `project` - the maven project
  `webappDirectory` -
Throws:
  `java.io.IOException` - if an error occurred while building the webapp
  `org.apache.maven.plugin.MojoExecutionException`

#### setAttributes

    protected void setAttributes(org.codehaus.plexus.archiver.jar.Manifest.Section mainSection)
                          throws org.apache.maven.plugin.MojoExecutionException,
                                 org.codehaus.plexus.archiver.jar.ManifestException,
                                 java.io.IOException

Throws:
  `org.apache.maven.plugin.MojoExecutionException`
  `org.codehaus.plexus.archiver.jar.ManifestException`
  `java.io.IOException`

#### isSupportDynamicLoading

    protected java.lang.Boolean isSupportDynamicLoading()
                                                 throws java.io.IOException

Is the dynamic loading supported? False, if the answer is known to be "No". Otherwise null, if there are some extensions we don't know we can dynamic load. Otherwise, if everything is known to be dynamic loadable, return true.

Throws:
  `java.io.IOException`