Package spoon.support.compiler
Class SpoonPom
java.lang.Object
spoon.support.compiler.SpoonPom
- All Implemented Interfaces:
- SpoonResource
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classAdditional options for maven invocations.
- 
Constructor SummaryConstructorsConstructorDescriptionSpoonPom(String path, MavenLauncher.SOURCE_TYPE sourceType, Environment environment)Extract the information from the pomSpoonPom(String path, MavenLauncher.SOURCE_TYPE sourceType, Environment environment, Pattern profileFilter)Extract the information from the pomSpoonPom(String path, SpoonPom parent, MavenLauncher.SOURCE_TYPE sourceType, Environment environment)Extract the information from the pomSpoonPom(String path, SpoonPom parent, MavenLauncher.SOURCE_TYPE sourceType, Environment environment, Pattern profileFilter)Extract the information from the pom
- 
Method SummaryModifier and TypeMethodDescriptionString[]buildClassPath(String mvnHome, MavenLauncher.SOURCE_TYPE sourceType, org.slf4j.Logger LOGGER, boolean forceRefresh)Call maven invoker to generate the classpath.String[]buildClassPath(String mvnHome, MavenLauncher.SOURCE_TYPE sourceType, org.slf4j.Logger LOGGER, boolean forceRefresh, SpoonPom.MavenOptions mavenOptions)Call maven invoker to generate the classpath.getClasspathTmpFiles(String fileName)Get the list of classpath files generated by mavenGets the parent of this resource on the file system.org.apache.maven.model.ModelgetModel()Get the Project Object ModelGet the list of modules defined in this POMgetName()Gets the name of this resource.Get the parent directoryGet the parent modelgetPath()Gets this resource path.Get the list of source directories of the projectintGet the source version of the projectGet the list of test directories of the projectstatic StringTry to guess Maven home when none is provided.booleanTells if this resource is an archive.booleanisFile()Tells if this resource is a file.toFile()Gets the corresponding file if possible (returns null if this resource does not correspond to any file on the filesystem).toString()
- 
Constructor Details- 
SpoonPompublic SpoonPom(String path, MavenLauncher.SOURCE_TYPE sourceType, Environment environment) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionExtract the information from the pom- Parameters:
- path- the path to the pom
- Throws:
- IOException- when the file does not exist
- org.codehaus.plexus.util.xml.pull.XmlPullParserException- when the file is corrupted
 
- 
SpoonPompublic SpoonPom(String path, MavenLauncher.SOURCE_TYPE sourceType, Environment environment, Pattern profileFilter) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionExtract the information from the pom- Parameters:
- path- the path to the pom
- profileFilter- regex pattern to filter profiles when expanding defined modules. Only modules in matching profiles are expanded
- Throws:
- IOException- when the file does not exist
- org.codehaus.plexus.util.xml.pull.XmlPullParserException- when the file is corrupted
 
- 
SpoonPompublic SpoonPom(String path, SpoonPom parent, MavenLauncher.SOURCE_TYPE sourceType, Environment environment) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionExtract the information from the pom- Parameters:
- path- the path to the pom
- parent- the parent pom
- Throws:
- IOException- when the file does not exist
- org.codehaus.plexus.util.xml.pull.XmlPullParserException- when the file is corrupted
 
- 
SpoonPompublic SpoonPom(String path, SpoonPom parent, MavenLauncher.SOURCE_TYPE sourceType, Environment environment, Pattern profileFilter) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionExtract the information from the pom- Parameters:
- path- the path to the pom
- parent- the parent pom
- profileFilter- regex pattern to filter profiles when expanding defined modules. Only modules in matching profiles are expanded
- Throws:
- IOException- when the file does not exist
- org.codehaus.plexus.util.xml.pull.XmlPullParserException- when the file is corrupted
 
 
- 
- 
Method Details- 
getModulesGet the list of modules defined in this POM- Returns:
- the list of modules
 
- 
getModelpublic org.apache.maven.model.Model getModel()Get the Project Object Model- Returns:
- the Project Object Model
 
- 
getSourceDirectoriesGet the list of source directories of the project- Returns:
- the list of source directories
 
- 
getTestDirectoriesGet the list of test directories of the project- Returns:
- the list of test directories
 
- 
getClasspathTmpFilesGet the list of classpath files generated by maven- Returns:
- the list of classpath files
 
- 
getSourceVersionpublic int getSourceVersion()Get the source version of the project- Returns:
- the source version of the project
 
- 
toString
- 
guessMavenHomeTry to guess Maven home when none is provided.- Returns:
- the path toward maven install on the local machine.
- Throws:
- SpoonException- if path to maven executable is wrong, process is interrupted, or maven home could not be found.
 
- 
buildClassPathpublic String[] buildClassPath(String mvnHome, MavenLauncher.SOURCE_TYPE sourceType, org.slf4j.Logger LOGGER, boolean forceRefresh)Call maven invoker to generate the classpath. Either M2_HOME must be initialized, or the command mvn must be in PATH.- Parameters:
- mvnHome- the path to the m2repository
- sourceType- the source type (App, test, or all)
- LOGGER- Logger used for maven output
- forceRefresh- if true forces the invocation of maven to regenerate classpath
- Returns:
- the complete classpath of the requested source types
 
- 
buildClassPathpublic String[] buildClassPath(String mvnHome, MavenLauncher.SOURCE_TYPE sourceType, org.slf4j.Logger LOGGER, boolean forceRefresh, SpoonPom.MavenOptions mavenOptions)Call maven invoker to generate the classpath. Either M2_HOME must be initialized, or the command mvn must be in PATH.- Parameters:
- mvnHome- the path to the m2repository
- sourceType- the source type (App, test, or all)
- LOGGER- Logger used for maven output
- forceRefresh- if true forces the invocation of maven to regenerate classpath
- mavenOptions- additional options to pass to maven
 
- 
getParentPomGet the parent model- Returns:
- the parent model
 
- 
getParentGet the parent directory- Specified by:
- getParentin interface- SpoonResource
- Returns:
- the parent directory
 
- 
getFileSystemParentDescription copied from interface:SpoonResourceGets the parent of this resource on the file system.- Specified by:
- getFileSystemParentin interface- SpoonResource
 
- 
getNameDescription copied from interface:SpoonResourceGets the name of this resource.- Specified by:
- getNamein interface- SpoonResource
 
- 
isFilepublic boolean isFile()Description copied from interface:SpoonResourceTells if this resource is a file.- Specified by:
- isFilein interface- SpoonResource
 
- 
isArchivepublic boolean isArchive()Description copied from interface:SpoonResourceTells if this resource is an archive.- Specified by:
- isArchivein interface- SpoonResource
 
- 
getPathDescription copied from interface:SpoonResourceGets this resource path.- Specified by:
- getPathin interface- SpoonResource
 
- 
toFileDescription copied from interface:SpoonResourceGets the corresponding file if possible (returns null if this resource does not correspond to any file on the filesystem).- Specified by:
- toFilein interface- SpoonResource
 
 
-