public class Maven extends Builder
Modifier and Type | Class and Description |
---|---|
static class |
Maven.DescriptorImpl |
static class |
Maven.MavenInstallation
Represents a Maven installation in a system.
|
static class |
Maven.MavenInstaller
Automatic Maven installer from apache.org.
|
static interface |
Maven.ProjectWithMaven
Optional interface that can be implemented by
AbstractProject
that has "contextual" Maven.MavenInstallation associated with it. |
ExtensionPoint.LegacyInstancesAreScopedToHudson
BuildStep.PublisherList
Modifier and Type | Field and Description |
---|---|
static Maven.DescriptorImpl |
DESCRIPTOR
Deprecated.
as of 1.286
Use
Jenkins.getDescriptorByType(Class) to obtain the current instance.
For compatibility, this field retains the last created Maven.DescriptorImpl . |
String |
jvmOptions
MAVEN_OPTS if not null.
|
String |
mavenName
Identifies
Maven.MavenInstallation to be used. |
String |
pom
Optional POM file path relative to the workspace.
|
String |
properties
Optional properties to be passed to Maven.
|
String |
targets
The targets and other maven options.
|
boolean |
usePrivateRepository
If true, the build will use its own local Maven repository
via "-Dmaven.repo.local=...".
|
BUILDERS, PUBLISHERS
Constructor and Description |
---|
Maven(String targets,
String name) |
Maven(String targets,
String name,
String pom,
String properties,
String jvmOptions) |
Maven(String targets,
String name,
String pom,
String properties,
String jvmOptions,
boolean usePrivateRepository) |
Maven(String targets,
String name,
String pom,
String properties,
String jvmOptions,
boolean usePrivateRepository,
SettingsProvider settings,
GlobalSettingsProvider globalSettings) |
Maven(String targets,
String name,
String pom,
String properties,
String jvmOptions,
boolean usePrivateRepository,
SettingsProvider settings,
GlobalSettingsProvider globalSettings,
boolean injectBuildVariables) |
Modifier and Type | Method and Description |
---|---|
protected void |
buildEnvVars(EnvVars env,
Maven.MavenInstallation mi)
Build up the environment variables toward the Maven launch.
|
Maven.DescriptorImpl |
getDescriptor()
Gets the descriptor for this instance.
|
GlobalSettingsProvider |
getGlobalSettings() |
Maven.MavenInstallation |
getMaven()
Gets the Maven to invoke,
or null to invoke the default one.
|
SettingsProvider |
getSettings() |
String |
getTargets() |
boolean |
isInjectBuildVariables() |
boolean |
perform(AbstractBuild<?,?> build,
Launcher launcher,
BuildListener listener)
Runs the step over the given build and reports the progress to the listener.
|
protected void |
setGlobalSettings(GlobalSettingsProvider globalSettings) |
protected void |
setSettings(SettingsProvider settings) |
void |
setUsePrivateRepository(boolean usePrivateRepository) |
boolean |
usesPrivateRepository() |
protected void |
wrapUpArguments(ArgumentListBuilder args,
String normalizedTarget,
AbstractBuild<?,?> build,
Launcher launcher,
BuildListener listener)
Allows the derived type to make additional modifications to the arguments list.
|
all, getRequiredMonitorService, prebuild
getProjectAction, getProjectAction, getProjectActions, perform, prebuild
public final String targets
public final String mavenName
Maven.MavenInstallation
to be used.public final String jvmOptions
public final String pom
public final String properties
Properties
syntax.public boolean usePrivateRepository
This would consume additional disk space, but provides isolation with other builds on the same machine, such as mixing SNAPSHOTS. Maven also doesn't try to coordinate the concurrent access to Maven repositories from multiple Maven process, so this helps there too. Identical to logic used in maven-plugin.
@Deprecated @Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static Maven.DescriptorImpl DESCRIPTOR
Jenkins.getDescriptorByType(Class)
to obtain the current instance.
For compatibility, this field retains the last created Maven.DescriptorImpl
.public Maven(String targets, String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository)
public Maven(String targets, String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository, SettingsProvider settings, GlobalSettingsProvider globalSettings)
@DataBoundConstructor public Maven(String targets, String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository, SettingsProvider settings, GlobalSettingsProvider globalSettings, boolean injectBuildVariables)
public String getTargets()
public SettingsProvider getSettings()
protected void setSettings(SettingsProvider settings)
public GlobalSettingsProvider getGlobalSettings()
protected void setGlobalSettings(GlobalSettingsProvider globalSettings)
public void setUsePrivateRepository(boolean usePrivateRepository)
public boolean usesPrivateRepository()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isInjectBuildVariables()
public Maven.MavenInstallation getMaven()
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
BuildStep
A plugin can contribute the action object to Actionable.getActions()
so that a 'report' becomes a part of the persisted data of Build
.
This is how JUnit plugin attaches the test report to a build page, for example.
When this build step needs to make (direct or indirect) permission checks to ACL
(for example, to locate other projects by name, build them, or access their artifacts)
then it must be run under a specific Authentication
.
In such a case, the implementation should check whether Jenkins.getAuthentication2()
is ACL.SYSTEM2
,
and if so, replace it for the duration of this step with Jenkins.ANONYMOUS
.
(Either using ACL.impersonate2(org.springframework.security.core.Authentication)
, or by making explicit calls to ACL.hasPermission2(Authentication, Permission)
.)
This would typically happen when no QueueItemAuthenticator
was available, configured, and active.
perform
in interface BuildStep
perform
in class BuildStepCompatibilityLayer
SimpleBuildStep.perform(Run, FilePath, Launcher, TaskListener)
if possible, always returning true or throwing an error.IOException
- If the implementation wants to abort the processing when an IOException
happens, it can simply propagate the exception to the caller. This will cause
the build to fail, with the default error message.
Implementations are encouraged to catch IOException
on its own to
provide a better error message, if it can do so, so that users have better
understanding on why it failed.InterruptedException
- If the build is interrupted by the user (in an attempt to abort the build.)
Normally the BuildStep
implementations may simply forward the exception
it got from its lower-level functions.protected void wrapUpArguments(ArgumentListBuilder args, String normalizedTarget, AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
IOException
InterruptedException
protected void buildEnvVars(EnvVars env, Maven.MavenInstallation mi) throws IOException, InterruptedException
IOException
InterruptedException
public Maven.DescriptorImpl getDescriptor()
Describable
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass() == b.getClass()
then by default
a.getDescriptor() == b.getDescriptor()
as well.
(In rare cases a single implementation class may be used for instances with distinct descriptors.)
getDescriptor
in interface Describable<Builder>
getDescriptor
in class Builder
Copyright © 2004–2022. All rights reserved.