Package hudson.maven
Class AbstractMavenProcessFactory
- java.lang.Object
-
- hudson.maven.AbstractMavenProcessFactory
-
- Direct Known Subclasses:
Maven3ProcessFactory
public abstract class AbstractMavenProcessFactory extends Object
Launches the maven process. This class captures the common part, andMavenProcessFactory
andMaven3ProcessFactory
adds Maven2/Maven3 flavors to it to make it concrete.- Author:
- Olivier Lamy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractMavenProcessFactory.GetRemotingJar
static class
AbstractMavenProcessFactory.UserInetTcpSocketHostLocator
-
Field Summary
Fields Modifier and Type Field Description static int
debugPort
If not 0, launch Maven with a debugger port.static String
MAVEN_REMOTE_USEINET_ENV_VAR_NAME
static boolean
mavenRemoteUseInet
static boolean
yjp
If true, launch Maven with YJP offline profiler agent.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
addRunHeadLessOption(String mavenOpts)
protected abstract void
applyPlexusModuleContributor(hudson.remoting.Channel channel, AbstractMavenBuild<?,?> context)
Apply extension plexus modules to the newly launched Maven process.protected ArgumentListBuilder
buildMavenAgentCmdLine(BuildListener listener, String tcpSocket)
Builds the command line argument list to launch the maven process.protected String
classPathEntry(FilePath root, Class<?> representative, String seedName, TaskListener listener)
Copies a Maven-related JAR to the agent on demand.protected Node
getCurrentNode()
Returns the currentNode
on which we are buildling.protected EnvVars
getEnvVars()
JDK
getJava(TaskListener log)
protected Launcher
getLauncher()
protected abstract String
getMainClassName()
Returns the name of the Maven main class.protected abstract String
getMavenAgentClassPath(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener)
Returns the classpath string for the maven-agent jar including classworldsMaven.MavenInstallation
getMavenInstallation(TaskListener log)
protected abstract String
getMavenInterceptorClassPath(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener)
Returns the classpath string for the maven-interceptor jarprotected String
getMavenInterceptorCommonClassPath(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener)
Returns the classpath string for the maven-interceptor jarprotected abstract String
getMavenInterceptorOverride(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener)
For Maven 2.1.x - 2.2.x we need an additional jar which overrides some classes in the other interceptor jar.protected MavenModuleSet
getMavenModuleSet()
String
getMavenOpts()
ProcessCache.NewProcess
newProcess(BuildListener listener, OutputStream out)
Starts maven process.
-
-
-
Field Detail
-
mavenRemoteUseInet
public static boolean mavenRemoteUseInet
-
MAVEN_REMOTE_USEINET_ENV_VAR_NAME
public static final String MAVEN_REMOTE_USEINET_ENV_VAR_NAME
- See Also:
- Constant Field Values
-
yjp
public static boolean yjp
If true, launch Maven with YJP offline profiler agent.
-
debugPort
public static int debugPort
If not 0, launch Maven with a debugger port.
-
-
Method Detail
-
newProcess
public ProcessCache.NewProcess newProcess(BuildListener listener, OutputStream out) throws IOException, InterruptedException
Starts maven process.- Throws:
IOException
InterruptedException
-
applyPlexusModuleContributor
protected abstract void applyPlexusModuleContributor(hudson.remoting.Channel channel, AbstractMavenBuild<?,?> context) throws InterruptedException, IOException
Apply extension plexus modules to the newly launched Maven process.- Parameters:
channel
- Channel to the Maven process.context
- Context thatPlexusModuleContributor
needs to figure out what it needs to do.- Throws:
InterruptedException
IOException
- Since:
- 1.519
-
buildMavenAgentCmdLine
protected ArgumentListBuilder buildMavenAgentCmdLine(BuildListener listener, String tcpSocket) throws IOException, InterruptedException
Builds the command line argument list to launch the maven process.- Throws:
IOException
InterruptedException
-
getMavenAgentClassPath
protected abstract String getMavenAgentClassPath(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException
Returns the classpath string for the maven-agent jar including classworlds- Throws:
IOException
InterruptedException
-
getMavenInterceptorClassPath
protected abstract String getMavenInterceptorClassPath(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException
Returns the classpath string for the maven-interceptor jar- Throws:
IOException
InterruptedException
-
getMavenInterceptorCommonClassPath
protected String getMavenInterceptorCommonClassPath(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException
Returns the classpath string for the maven-interceptor jar- Throws:
IOException
InterruptedException
- Since:
- 1.525
-
getMavenInterceptorOverride
protected abstract String getMavenInterceptorOverride(Maven.MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException
For Maven 2.1.x - 2.2.x we need an additional jar which overrides some classes in the other interceptor jar.- Throws:
IOException
InterruptedException
-
getMainClassName
protected abstract String getMainClassName()
Returns the name of the Maven main class.
-
getMavenOpts
public String getMavenOpts()
-
getMavenInstallation
public Maven.MavenInstallation getMavenInstallation(TaskListener log) throws IOException, InterruptedException
- Throws:
IOException
InterruptedException
-
getJava
@CheckForNull public JDK getJava(TaskListener log) throws IOException, InterruptedException
- Throws:
IOException
InterruptedException
-
classPathEntry
protected final String classPathEntry(FilePath root, Class<?> representative, String seedName, TaskListener listener) throws IOException, InterruptedException
Copies a Maven-related JAR to the agent on demand. Can also be used when run on controller.- Parameters:
root
- the FS root of the agent (null means running on the built-in node)representative
- a representative class present in the JARseedName
- the basename of the JARlistener
- a listener for any problems- Returns:
- the (local or remote) absolute path of the JAR
- Throws:
IOException
- in case copying failsInterruptedException
- in case copying is interrupted- Since:
- 1.530
-
getMavenModuleSet
protected MavenModuleSet getMavenModuleSet()
-
getLauncher
protected Launcher getLauncher()
-
getEnvVars
protected EnvVars getEnvVars()
-
-