Class SourceFeatureMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.tycho.extras.sourcefeature.SourceFeatureMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="source-feature", defaultPhase=PACKAGE) public class SourceFeatureMojo extends org.apache.maven.plugin.AbstractMojoGenerates a source feature for projects of packaging typeeclipse-feature. By default, the generated source feature- Declares feature id
<originalFeatureId>.source - Declares feature label
"<originalFeatureLabel> Developer Resources" - If present, reuses feature provider, description, copyright and license as well as respective URLs from <originalFeature>
- Includes all plugins included by <originalFeature>, but each with
.sourceappended to each plugin id - Includes all features included by <originalFeature>, but each with
.sourceappended to each feature id - Includes the original feature. This ensures that binaries and corresponding sources match.
sourceTemplateFeature/. Files added here will be added to the root of the source feature jar. Especially, if filesourceTemplateFeature/feature.propertiesis found, values in this file override values of respective keys in<originalFeature>/feature.properties.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.archiver.MavenArchiveConfigurationarchiveprivate java.lang.StringbrandingPluginUse this to explicitly set the branding plugin attribute of the generated source feature (overridesreuseBrandingPlugin).private BuildPropertiesParserbuildPropertiesParserprivate EquinoxServiceFactoryequinoxprivate java.util.Set<java.lang.String>excludedFeaturesprivate java.util.Set<java.lang.String>excludedPluginsprivate org.codehaus.plexus.configuration.PlexusConfigurationexcludesBundles and features that do not have corresponding sources.private java.util.Set<PluginRef>extraPluginsprivate static java.lang.StringFEATURE_PROPERTIESstatic java.lang.StringFEATURE_TEMPLATE_DIRprivate java.lang.StringfinalNameThe filename to be used for the generated archive file.private static java.lang.StringGEN_DIRprivate booleanincludeBinaryFeatureWhether to add an include dependency from the source feature to the corresponding binary feature.private org.codehaus.plexus.archiver.jar.JarArchiverjarArchiverprivate java.lang.StringlabelSuffixSource feature label suffix.private LicenseFeatureHelperlicenseFeatureHelperprivate org.codehaus.plexus.logging.Loggerloggerprivate org.codehaus.plexus.configuration.PlexusConfigurationpluginsAdditional plugins to include in the generated source feature.private org.apache.maven.project.MavenProjectprojectprivate org.apache.maven.project.MavenProjectHelperprojectHelperprivate booleanreuseBrandingPluginWhether to reuse an explicit branding plugin from the binary feature for the generated source feature.private org.apache.maven.execution.MavenSessionsessionprivate booleanskipWhether to skip source feature generation.static java.lang.StringSOURCES_FEATURE_CLASSIFIERprotected booleanuseDefaultExcludes
-
Constructor Summary
Constructors Constructor Description SourceFeatureMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPlugin(Feature sourceFeature, P2ResolutionResult result, PluginRef pluginRef)(package private) FeaturecreateSourceFeatureSkeleton(Feature feature, java.util.Properties mergedFeatureProperties, java.util.Properties sourceTemplateProperties)This only create the new feature skeleton by setting labels and other not-structural values that don't require platform resolution.voidexecute()private voidfillReferences(Feature sourceFeature, Feature feature, TargetPlatform targetPlatform)Added all references to sourceFeature, as deduced by feature and resolved by targetPlatformprivate java.io.FilegenerateSourceFeatureXml(java.util.Properties mergedSourceFeatureProps, java.util.Properties sourceTemplateProps)private java.lang.StringgetAttribute(org.codehaus.plexus.configuration.PlexusConfiguration dom, java.lang.String attrName)protected org.codehaus.plexus.archiver.FileSetgetFileSet(java.io.File basedir, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes)private org.codehaus.plexus.archiver.FileSetgetManuallyIncludedFiles(java.io.File basedir, BuildProperties buildProperties)private java.io.FilegetMergedSourceFeaturePropertiesFile()protected java.io.FilegetOutputJarFile()(package private) static java.io.FilegetSourcesFeatureOutputDir(org.apache.maven.project.MavenProject project)private java.util.PropertiesmergeFeatureProperties(java.util.Properties sourceFeatureTemplateProps)private static java.util.PropertiesreadPropertiesIfExists(java.io.File propertiesFile)private java.util.PropertiesreadSourceTemplateFeatureProperties()voidsetExcludes(org.codehaus.plexus.configuration.PlexusConfiguration excludes)voidsetPlugins(org.codehaus.plexus.configuration.PlexusConfiguration bundles)protected java.lang.StringtoStrictVersionRange(java.lang.String version)private static java.lang.StringvalidateValue(java.lang.String fieldValue, java.util.Properties sourceFeatureProperties)Returns the value for a field.private static voidwriteProperties(java.util.Properties props, java.io.File propertiesFile)
-
-
-
Field Detail
-
FEATURE_TEMPLATE_DIR
public static final java.lang.String FEATURE_TEMPLATE_DIR
- See Also:
- Constant Field Values
-
SOURCES_FEATURE_CLASSIFIER
public static final java.lang.String SOURCES_FEATURE_CLASSIFIER
- See Also:
- Constant Field Values
-
FEATURE_PROPERTIES
private static final java.lang.String FEATURE_PROPERTIES
- See Also:
- Constant Field Values
-
GEN_DIR
private static final java.lang.String GEN_DIR
- See Also:
- Constant Field Values
-
project
@Parameter(property="project", readonly=true) private org.apache.maven.project.MavenProject project
-
skip
@Parameter(defaultValue="false") private boolean skip
Whether to skip source feature generation.
-
includeBinaryFeature
@Parameter(defaultValue="true") private boolean includeBinaryFeature
Whether to add an include dependency from the source feature to the corresponding binary feature. Iftrue, this ensures the version of the installed sources matches the binaries.
-
labelSuffix
@Parameter(defaultValue=" Developer Resources") private java.lang.String labelSuffix
Source feature label suffix. Unless explicitly provided insourceTemplateFeature/feature.properties, this suffix will be appended to the original feature label to construct the source feature label.
-
brandingPlugin
@Parameter private java.lang.String brandingPlugin
Use this to explicitly set the branding plugin attribute of the generated source feature (overridesreuseBrandingPlugin).
-
reuseBrandingPlugin
@Parameter(defaultValue="true") private boolean reuseBrandingPlugin
Whether to reuse an explicit branding plugin from the binary feature for the generated source feature.
-
excludes
@Parameter private org.codehaus.plexus.configuration.PlexusConfiguration excludes
Bundles and features that do not have corresponding sources. Example:<excludes> <plugin id="plugin.nosource"/> <feature id="feature.nosource"/> </excludes>
-
plugins
@Parameter private org.codehaus.plexus.configuration.PlexusConfiguration plugins
Additional plugins to include in the generated source feature. Beware that these additional plugins are not considered during build target platform calculation and ordering of reactor projects. Use <extraRequirements> dependency resolver configuration to guarantee proper reactor build order.WARNING This experimental parameter may be removed from future source-feature mojo versions without prior notice.
-
useDefaultExcludes
@Parameter(defaultValue="true") protected boolean useDefaultExcludes
-
session
@Parameter(property="session", readonly=true) private org.apache.maven.execution.MavenSession session
-
excludedPlugins
private final java.util.Set<java.lang.String> excludedPlugins
-
excludedFeatures
private final java.util.Set<java.lang.String> excludedFeatures
-
extraPlugins
private final java.util.Set<PluginRef> extraPlugins
-
archive
@Parameter private org.apache.maven.archiver.MavenArchiveConfiguration archive
-
finalName
@Parameter(property="project.build.finalName") private java.lang.String finalName
The filename to be used for the generated archive file. For the source-feature goal, "-sources-feature" is appended to this filename.
-
jarArchiver
@Component(role=org.codehaus.plexus.archiver.Archiver.class, hint="jar") private org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver
-
projectHelper
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
-
licenseFeatureHelper
@Component private LicenseFeatureHelper licenseFeatureHelper
-
buildPropertiesParser
@Component private BuildPropertiesParser buildPropertiesParser
-
equinox
@Component private EquinoxServiceFactory equinox
-
logger
@Component private org.codehaus.plexus.logging.Logger logger
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getSourcesFeatureOutputDir
static java.io.File getSourcesFeatureOutputDir(org.apache.maven.project.MavenProject project)
-
mergeFeatureProperties
private java.util.Properties mergeFeatureProperties(java.util.Properties sourceFeatureTemplateProps) throws java.io.IOException- Throws:
java.io.IOException
-
readSourceTemplateFeatureProperties
private java.util.Properties readSourceTemplateFeatureProperties() throws java.io.IOException- Throws:
java.io.IOException
-
generateSourceFeatureXml
private java.io.File generateSourceFeatureXml(java.util.Properties mergedSourceFeatureProps, java.util.Properties sourceTemplateProps) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException- Throws:
java.io.IOExceptionorg.apache.maven.plugin.MojoExecutionException
-
getMergedSourceFeaturePropertiesFile
private java.io.File getMergedSourceFeaturePropertiesFile()
-
readPropertiesIfExists
private static java.util.Properties readPropertiesIfExists(java.io.File propertiesFile) throws java.io.IOException- Throws:
java.io.IOException
-
writeProperties
private static void writeProperties(java.util.Properties props, java.io.File propertiesFile) throws java.io.IOException- Throws:
java.io.IOException
-
createSourceFeatureSkeleton
Feature createSourceFeatureSkeleton(Feature feature, java.util.Properties mergedFeatureProperties, java.util.Properties sourceTemplateProperties) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
This only create the new feature skeleton by setting labels and other not-structural values that don't require platform resolution.- Throws:
java.io.IOExceptionorg.apache.maven.plugin.MojoExecutionException
-
validateValue
private static java.lang.String validateValue(java.lang.String fieldValue, java.util.Properties sourceFeatureProperties) throws org.apache.maven.plugin.MojoExecutionExceptionReturns the value for a field. In case the value is a reference to feature.properties, verify that the entry exist in the feature.properties file for source- Parameters:
fieldValue-sourceFeatureProperties-- Returns:
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
fillReferences
private void fillReferences(Feature sourceFeature, Feature feature, TargetPlatform targetPlatform) throws org.apache.maven.plugin.MojoExecutionException
Added all references to sourceFeature, as deduced by feature and resolved by targetPlatform- Parameters:
sourceFeature-feature-targetPlatform-- Throws:
org.apache.maven.plugin.MojoExecutionException
-
toStrictVersionRange
protected java.lang.String toStrictVersionRange(java.lang.String version)
-
addPlugin
protected void addPlugin(Feature sourceFeature, P2ResolutionResult result, PluginRef pluginRef)
-
getOutputJarFile
protected java.io.File getOutputJarFile()
-
setExcludes
public void setExcludes(org.codehaus.plexus.configuration.PlexusConfiguration excludes)
-
setPlugins
public void setPlugins(org.codehaus.plexus.configuration.PlexusConfiguration bundles)
-
getAttribute
private java.lang.String getAttribute(org.codehaus.plexus.configuration.PlexusConfiguration dom, java.lang.String attrName)
-
getManuallyIncludedFiles
private org.codehaus.plexus.archiver.FileSet getManuallyIncludedFiles(java.io.File basedir, BuildProperties buildProperties)- Returns:
- A
FileSetincluding files as configured by the src.includes and src.excludes properties without the files that are always included automatically.
-
getFileSet
protected org.codehaus.plexus.archiver.FileSet getFileSet(java.io.File basedir, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes)- Returns:
- a
FileSetwith the given includes and excludes and the configured default excludes. An empty list of includes leads to an empty file set.
-
-