Package spoon
Class MavenLauncher
java.lang.Object
spoon.Launcher
spoon.MavenLauncher
- All Implemented Interfaces:
SpoonAPI
Create a Spoon launcher from a maven pom file
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The type of source to consider in the model -
Field Summary
Fields inherited from class spoon.Launcher
ALL_DIR_FILTER, factory, jsapActualArgs, OUTPUTDIR, RESOURCES_FILE_FILTER, SPOONED_CLASSES
-
Constructor Summary
ConstructorDescriptionMavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType)
MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, boolean forceRefresh)
MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, boolean forceRefresh, Pattern profileFilter)
MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome)
MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String[] classpath)
MavenLauncher constructor that skips maven invocation building classpath.MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String[] classpath, Pattern profileFilter)
MavenLauncher constructor that skips maven invocation building classpath.MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome, boolean forceRefresh)
MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome, boolean forceRefresh, Pattern profileFilter)
MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome, Pattern profileFilter)
MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, Pattern profileFilter)
MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Triggers regeneration of the classpath that is used for building the model, based on pom.xmlprotected void
void
setEnvironmentVariable(String key, String value)
Adds an environment variable to the maven invocation.Methods inherited from class spoon.Launcher
addInputResource, addInputResource, addProcessor, addProcessor, addTemplateResource, buildModel, createCompiler, createCompiler, createCompiler, createCompiler, createCompiler, createEnvironment, createFactory, createOutputWriter, createPrettyPrinter, defineArgs, getArguments, getCompilerInstance, getEnvironment, getFactory, getModel, getModelBuilder, getProcessors, getProcessorTypes, main, parseArgs, parseClass, prettyprint, printUsage, process, processArguments, run, run, setArgs, setBinaryOutputDirectory, setBinaryOutputDirectory, setOutputFilter, setOutputFilter, setSourceOutputDirectory, setSourceOutputDirectory
-
Constructor Details
-
MavenLauncher
MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, Pattern profileFilter)MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)profileFilter
- regular expression of profiles to include in the built model
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, boolean forceRefresh)MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)forceRefresh
- force the regeneration of classpath
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, boolean forceRefresh, Pattern profileFilter)MavenLauncher constructor assuming either an environment variable M2_HOME, or that mvn command exists in PATH.- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)forceRefresh
- force the regeneration of classpathprofileFilter
- regular expression of profiles to include in the built model
-
MavenLauncher
- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)mvnHome
- Path to maven install
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome, Pattern profileFilter)- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)mvnHome
- Path to maven installprofileFilter
- regular expression of profiles to include in the built model
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome, boolean forceRefresh)- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)mvnHome
- Path to maven installforceRefresh
- force the regeneration of classpath
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String mvnHome, boolean forceRefresh, Pattern profileFilter)- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)mvnHome
- Path to maven installforceRefresh
- force the regeneration of classpathprofileFilter
- regular expression of profiles to include in the built model
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String[] classpath)MavenLauncher constructor that skips maven invocation building classpath.- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)classpath
- String array containing the classpath elements
-
MavenLauncher
public MavenLauncher(String mavenProject, MavenLauncher.SOURCE_TYPE sourceType, String[] classpath, Pattern profileFilter)MavenLauncher constructor that skips maven invocation building classpath.- Parameters:
mavenProject
- the path to the root of the projectsourceType
- the source type (App, test, or all)classpath
- String array containing the classpath elementsprofileFilter
- regular expression of profiles to include in the built model
-
-
Method Details
-
getPomFile
- Returns:
- SpoonPom corresponding to the pom file used by the launcher
-
setEnvironmentVariable
Adds an environment variable to the maven invocation.
Note that you need to callrebuildClasspath()
after calling this method for changes to take effect.- Parameters:
key
- the name of the environment variablevalue
- its value- See Also:
#rebuildClasspath() for changes to take effect
-
reportClassPathMode
protected void reportClassPathMode()- Overrides:
reportClassPathMode
in classLauncher
-
rebuildClasspath
public void rebuildClasspath()Triggers regeneration of the classpath that is used for building the model, based on pom.xml
-