Package org.eclipse.tycho.pomgenerator
Class GeneratePomsMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.tycho.pomgenerator.GeneratePomsMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="generate-poms", requiresProject=false, threadSafe=true) public class GeneratePomsMojo extends org.apache.maven.plugin.AbstractMojo
Traverse the current directory to find eclipse-plugin/bundle, feature, update site (site.xml) or p2 repository (category.xml) projects and generate corresponding pom.xml's. This goal is intended to be used by existing projects for generating quick-start pom.xml's when converting their build to Tycho. The generated pom.xml's are only intended as a starting point and will most probably require manual refinement. Note that this goal is not intended for automatic pom.xml generation during build.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
GeneratePomsMojo.DirectoryFilter
-
Field Summary
Fields Modifier and Type Field Description private boolean
aggregator
If true (the default), additional aggregator poma.xml pom file will be generated for update site projects.private java.io.File
baseDir
The base directory which will be traversed recursively when searching for projects.private BundleReader
bundleReader
private DependencyComputer
dependencyComputer
private java.lang.String
executionEnvironment
private java.lang.String
extraDirs
Additional directories to be traversed recursively when searching for projects.private java.lang.String
groupId
Maven groupId to be used in the generated pom.xml files.private static java.lang.Object
LOCK
private static java.lang.String
METADATA_DIR
Metadata directory that should be skipped when searching for projects(package private) org.apache.maven.model.io.xpp3.MavenXpp3Reader
modelReader
(package private) org.apache.maven.model.io.xpp3.MavenXpp3Writer
modelWriter
private DefaultDependencyArtifacts
platform
private java.lang.String
repoID
ID of the p2 repository to add in the aggregator pom.private java.lang.String
repoURL
URL to p2 repository to add in the aggregator pom.private EquinoxResolver
resolver
private java.lang.String
rootProjects
Comma separated list of root project folders.private java.io.File
templatesDir
Location of directory with template pom.xml file.private java.lang.String
testSuffix
Suffix used to determine test bundles to add to update site aggregator pom.private java.lang.String
testSuite
Bundle-SymbolicName of the test suite, a special bundle that knows how to locate and execute all relevant tests.private static java.lang.String
THIS_MODULE
reference to real pom.xml in aggregator poma.xmlprivate java.lang.String
tychoVersion
Tycho version to be used in the generated pom.xml files.private java.util.Map<java.io.File,org.apache.maven.model.Model>
updateSites
private java.lang.String
version
Maven version to be used in the generated pom.xml files (applies to parent pom and eclipse-repository/eclipse-update-site only).
-
Constructor Summary
Constructors Constructor Description GeneratePomsMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addFeature(java.util.Set<java.io.File> result, java.lang.String name)
private void
addPlugin(java.util.Set<java.io.File> result, java.lang.String name)
private void
addPluginImpl(java.util.Set<java.io.File> result, java.io.File basedir)
private void
addPluginImpl(java.util.Set<java.io.File> result, java.lang.String name, boolean required)
private void
addTychoExtension(org.apache.maven.model.Model model)
void
execute()
private void
findAndAddCandidates(java.util.List<java.io.File> candidateDirs, java.io.File basedir)
private void
generateAggregatorPoms(java.io.File testSuiteLocation)
private void
generateEclipseRepositoryPom(org.apache.maven.model.Model parent, java.io.File basedir)
private void
generateFeaturePom(org.apache.maven.model.Model parent, java.io.File basedir)
private void
generatePluginPom(org.apache.maven.model.Model parent, java.io.File basedir)
private boolean
generatePom(org.apache.maven.model.Model parent, java.io.File basedir)
private void
generateUpdateSitePom(org.apache.maven.model.Model parent, java.io.File basedir)
protected ArtifactDescriptor
getArtifact(java.io.File basedir)
private java.util.List<java.io.File>
getBaseDirs()
private java.util.Set<java.io.File>
getFeatureFeaturesAndPlugins(java.io.File basedir)
private java.io.File
getModuleDir(java.lang.String name)
private java.lang.String
getModuleName(java.io.File basedir, java.io.File dir)
private java.lang.String
getRelativePath(java.io.File basedir, java.io.File dir)
private java.util.List<java.io.File>
getRootProjects()
private java.util.Set<java.io.File>
getSiteFeaturesAndPlugins(java.io.File basedir)
private boolean
isEclipseRepositoryProject(java.io.File dir)
private boolean
isFeatureProject(java.io.File dir)
private boolean
isModule(java.io.File basedir, java.io.File dir)
private boolean
isModuleDir(java.io.File dir)
private boolean
isPluginProject(java.io.File dir)
private boolean
isProjectDir(java.io.File dir)
private boolean
isUpdateSiteProject(java.io.File dir)
private org.apache.maven.model.Model
readPomTemplate(java.lang.String name)
private void
reorderModules(org.apache.maven.model.Model parent, java.io.File basedir, java.io.File testSuiteLocation)
private void
setParentOrAddTychoExtension(java.io.File basedir, org.apache.maven.model.Model model, org.apache.maven.model.Model parentModel)
private java.util.List<java.io.File>
toFileList(java.lang.String str)
private static java.lang.String
toMavenVersion(java.lang.String osgiVersion)
private java.lang.String
toString(java.io.File file)
private void
warnNoBundleDependencies(java.lang.Exception e)
private void
writePom(java.io.File dir, java.lang.String filename, org.apache.maven.model.Model model)
private void
writePom(java.io.File dir, org.apache.maven.model.Model model)
-
-
-
Field Detail
-
LOCK
private static final java.lang.Object LOCK
-
METADATA_DIR
private static final java.lang.String METADATA_DIR
Metadata directory that should be skipped when searching for projects- See Also:
- Constant Field Values
-
THIS_MODULE
private static final java.lang.String THIS_MODULE
reference to real pom.xml in aggregator poma.xml- See Also:
- Constant Field Values
-
tychoVersion
@Parameter(property="plugin.version", readonly=true) private java.lang.String tychoVersion
Tycho version to be used in the generated pom.xml files.
-
baseDir
@Parameter(property="baseDir", defaultValue="${basedir}", required=true) private java.io.File baseDir
The base directory which will be traversed recursively when searching for projects.
-
extraDirs
@Parameter(property="extraDirs") private java.lang.String extraDirs
Additional directories to be traversed recursively when searching for projects.
-
groupId
@Parameter(property="groupId") private java.lang.String groupId
Maven groupId to be used in the generated pom.xml files.
-
version
@Parameter(property="version", defaultValue="0.0.1-SNAPSHOT") private java.lang.String version
Maven version to be used in the generated pom.xml files (applies to parent pom and eclipse-repository/eclipse-update-site only).
-
aggregator
@Parameter(property="aggregator", defaultValue="true") private boolean aggregator
If true (the default), additional aggregator poma.xml pom file will be generated for update site projects. This poma.xml file can be used to build update site and all its dependencies.
-
testSuffix
@Parameter(property="testSuffix", defaultValue=".tests") private java.lang.String testSuffix
Suffix used to determine test bundles to add to update site aggregator pom.
-
testSuite
@Parameter(property="testSuite") private java.lang.String testSuite
Bundle-SymbolicName of the test suite, a special bundle that knows how to locate and execute all relevant tests.
-
repoURL
@Parameter(property="repoURL") private java.lang.String repoURL
URL to p2 repository to add in the aggregator pom.
-
repoID
@Parameter(property="repoID", defaultValue="injected-repository") private java.lang.String repoID
ID of the p2 repository to add in the aggregator pom.
-
templatesDir
@Parameter(property="templatesDir", defaultValue="${basedir}/pom-templates") private java.io.File templatesDir
Location of directory with template pom.xml file. pom.xml templates will be looked at this directory first, default templates will be used if template directory and the template itself does not exist. See src/main/resources/templates for the list of supported template files.
-
rootProjects
@Parameter(property="rootProjects") private java.lang.String rootProjects
Comma separated list of root project folders. If specified, generated pom.xml files will only include root projects and projects directly and indirectly referenced by the root projects.
-
executionEnvironment
@Parameter(defaultValue="J2SE-1.5") private java.lang.String executionEnvironment
-
bundleReader
@Component(role=BundleReader.class) private BundleReader bundleReader
-
resolver
@Component(role=EquinoxResolver.class) private EquinoxResolver resolver
-
dependencyComputer
@Component(role=DependencyComputer.class) private DependencyComputer dependencyComputer
-
modelReader
org.apache.maven.model.io.xpp3.MavenXpp3Reader modelReader
-
modelWriter
org.apache.maven.model.io.xpp3.MavenXpp3Writer modelWriter
-
updateSites
private java.util.Map<java.io.File,org.apache.maven.model.Model> updateSites
-
platform
private DefaultDependencyArtifacts platform
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
findAndAddCandidates
private void findAndAddCandidates(java.util.List<java.io.File> candidateDirs, java.io.File basedir)
-
getRootProjects
private java.util.List<java.io.File> getRootProjects()
-
isProjectDir
private boolean isProjectDir(java.io.File dir)
-
reorderModules
private void reorderModules(org.apache.maven.model.Model parent, java.io.File basedir, java.io.File testSuiteLocation) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addTychoExtension
private void addTychoExtension(org.apache.maven.model.Model model)
-
toString
private java.lang.String toString(java.io.File file)
-
getBaseDirs
private java.util.List<java.io.File> getBaseDirs()
-
toFileList
private java.util.List<java.io.File> toFileList(java.lang.String str)
-
getModuleName
private java.lang.String getModuleName(java.io.File basedir, java.io.File dir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getRelativePath
private java.lang.String getRelativePath(java.io.File basedir, java.io.File dir)
-
generateAggregatorPoms
private void generateAggregatorPoms(java.io.File testSuiteLocation) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
generatePom
private boolean generatePom(org.apache.maven.model.Model parent, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
isUpdateSiteProject
private boolean isUpdateSiteProject(java.io.File dir)
-
isEclipseRepositoryProject
private boolean isEclipseRepositoryProject(java.io.File dir)
-
isFeatureProject
private boolean isFeatureProject(java.io.File dir)
-
isPluginProject
private boolean isPluginProject(java.io.File dir)
-
generateUpdateSitePom
private void generateUpdateSitePom(org.apache.maven.model.Model parent, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
generateEclipseRepositoryPom
private void generateEclipseRepositoryPom(org.apache.maven.model.Model parent, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getSiteFeaturesAndPlugins
private java.util.Set<java.io.File> getSiteFeaturesAndPlugins(java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addFeature
private void addFeature(java.util.Set<java.io.File> result, java.lang.String name) throws java.io.IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException, org.apache.maven.plugin.MojoExecutionException
- Throws:
java.io.IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
org.apache.maven.plugin.MojoExecutionException
-
getModuleDir
private java.io.File getModuleDir(java.lang.String name) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getFeatureFeaturesAndPlugins
private java.util.Set<java.io.File> getFeatureFeaturesAndPlugins(java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addPlugin
private void addPlugin(java.util.Set<java.io.File> result, java.lang.String name) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addPluginImpl
private void addPluginImpl(java.util.Set<java.io.File> result, java.lang.String name, boolean required) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addPluginImpl
private void addPluginImpl(java.util.Set<java.io.File> result, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
warnNoBundleDependencies
private void warnNoBundleDependencies(java.lang.Exception e)
-
isModuleDir
private boolean isModuleDir(java.io.File dir)
-
isModule
private boolean isModule(java.io.File basedir, java.io.File dir)
-
setParentOrAddTychoExtension
private void setParentOrAddTychoExtension(java.io.File basedir, org.apache.maven.model.Model model, org.apache.maven.model.Model parentModel)
-
generateFeaturePom
private void generateFeaturePom(org.apache.maven.model.Model parent, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
generatePluginPom
private void generatePluginPom(org.apache.maven.model.Model parent, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getArtifact
protected ArtifactDescriptor getArtifact(java.io.File basedir)
-
toMavenVersion
private static java.lang.String toMavenVersion(java.lang.String osgiVersion)
-
writePom
private void writePom(java.io.File dir, org.apache.maven.model.Model model) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
writePom
private void writePom(java.io.File dir, java.lang.String filename, org.apache.maven.model.Model model) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
readPomTemplate
private org.apache.maven.model.Model readPomTemplate(java.lang.String name) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-