Class SourceFeatureMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="source-feature",
          defaultPhase=PACKAGE,
          threadSafe=true)
    @Deprecated(since="2.2",
                forRemoval=true)
    public class SourceFeatureMojo
    extends org.apache.maven.plugin.AbstractMojo
    Deprecated, for removal: This API element is subject to removal in a future version.
    this mojo is replaced by the tycho-source-plugin with execution feature-source which offers equivalent and even enhanced functionality
    Generates a source feature for projects of packaging type eclipse-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 .source appended to each plugin id
    • Includes all features included by <originalFeature>, but each with .source appended to each feature id
    • Includes the original feature. This ensures that binaries and corresponding sources match.
    Source feature generation can be customized by adding files under path sourceTemplateFeature/. Files added here will be added to the root of the source feature jar. Especially, if file sourceTemplateFeature/feature.properties is 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.MavenArchiveConfiguration archive
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.lang.String brandingPlugin
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use this to explicitly set the branding plugin attribute of the generated source feature (overrides reuseBrandingPlugin).
      private BuildPropertiesParser buildPropertiesParser
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private EquinoxServiceFactory equinox
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.util.Set<java.lang.String> excludedFeatures
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.util.Set<java.lang.String> excludedPlugins
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private org.codehaus.plexus.configuration.PlexusConfiguration excludes
      Deprecated, for removal: This API element is subject to removal in a future version.
      Bundles and features that do not have corresponding sources.
      private java.util.Set<PluginRef> extraPlugins
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private static java.lang.String FEATURE_PROPERTIES
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      static java.lang.String FEATURE_TEMPLATE_DIR
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.lang.String finalName
      Deprecated, for removal: This API element is subject to removal in a future version.
      The filename to be used for the generated archive file.
      private static java.lang.String GEN_DIR
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private boolean includeBinaryFeature
      Deprecated, for removal: This API element is subject to removal in a future version.
      Whether to add an include dependency from the source feature to the corresponding binary feature.
      private org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.lang.String labelSuffix
      Deprecated, for removal: This API element is subject to removal in a future version.
      Source feature label suffix.
      private LicenseFeatureHelper licenseFeatureHelper
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private static java.lang.Object LOCK
      Deprecated, for removal: This API element is subject to removal in a future version.
      Lock object to ensure thread-safety
      private org.codehaus.plexus.logging.Logger logger
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private org.codehaus.plexus.configuration.PlexusConfiguration plugins
      Deprecated, for removal: This API element is subject to removal in a future version.
      Additional plugins to include in the generated source feature.
      private org.apache.maven.project.MavenProject project
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private org.apache.maven.project.MavenProjectHelper projectHelper
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private boolean reuseBrandingPlugin
      Deprecated, for removal: This API element is subject to removal in a future version.
      Whether to reuse an explicit branding plugin from the binary feature for the generated source feature.
      private org.apache.maven.execution.MavenSession session
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private boolean skip
      Deprecated, for removal: This API element is subject to removal in a future version.
      Whether to skip source feature generation.
      static java.lang.String SOURCES_FEATURE_CLASSIFIER
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      protected boolean useDefaultExcludes
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      SourceFeatureMojo()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected void addPlugin​(Feature sourceFeature, P2ResolutionResult result, PluginRef pluginRef)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      (package private) Feature createSourceFeatureSkeleton​(Feature feature, java.util.Properties mergedFeatureProperties, java.util.Properties sourceTemplateProperties)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This only create the new feature skeleton by setting labels and other not-structural values that don't require platform resolution.
      void execute()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private void fillReferences​(Feature sourceFeature, Feature feature, TargetPlatform targetPlatform)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Added all references to sourceFeature, as deduced by feature and resolved by targetPlatform
      private java.io.File generateSourceFeatureXml​(java.util.Properties mergedSourceFeatureProps, java.util.Properties sourceTemplateProps)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.lang.String getAttribute​(org.codehaus.plexus.configuration.PlexusConfiguration dom, java.lang.String attrName)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      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)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private org.codehaus.plexus.archiver.FileSet getManuallyIncludedFiles​(java.io.File basedir, BuildProperties buildProperties)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.io.File getMergedSourceFeaturePropertiesFile()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      protected java.io.File getOutputJarFile()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      (package private) static java.io.File getSourcesFeatureOutputDir​(org.apache.maven.project.MavenProject project)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.util.Properties mergeFeatureProperties​(java.util.Properties sourceFeatureTemplateProps)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private static java.util.Properties readPropertiesIfExists​(java.io.File propertiesFile)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private java.util.Properties readSourceTemplateFeatureProperties()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      void setExcludes​(org.codehaus.plexus.configuration.PlexusConfiguration excludes)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      void setPlugins​(org.codehaus.plexus.configuration.PlexusConfiguration bundles)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      protected java.lang.String toStrictVersionRange​(java.lang.String version)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      private static java.lang.String validateValue​(java.lang.String fieldValue, java.util.Properties sourceFeatureProperties)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the value for a field.
      private static void writeProperties​(java.util.Properties props, java.io.File propertiesFile)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOCK

        private static final java.lang.Object LOCK
        Deprecated, for removal: This API element is subject to removal in a future version.
        Lock object to ensure thread-safety
      • FEATURE_TEMPLATE_DIR

        public static final java.lang.String FEATURE_TEMPLATE_DIR
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
      • SOURCES_FEATURE_CLASSIFIER

        public static final java.lang.String SOURCES_FEATURE_CLASSIFIER
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
      • FEATURE_PROPERTIES

        private static final java.lang.String FEATURE_PROPERTIES
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
      • GEN_DIR

        private static final java.lang.String GEN_DIR
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
      • project

        @Parameter(property="project",
                   readonly=true)
        private org.apache.maven.project.MavenProject project
        Deprecated, for removal: This API element is subject to removal in a future version.
      • skip

        @Parameter(defaultValue="false")
        private boolean skip
        Deprecated, for removal: This API element is subject to removal in a future version.
        Whether to skip source feature generation.
      • includeBinaryFeature

        @Parameter(defaultValue="true")
        private boolean includeBinaryFeature
        Deprecated, for removal: This API element is subject to removal in a future version.
        Whether to add an include dependency from the source feature to the corresponding binary feature. If true, this ensures the version of the installed sources matches the binaries.
      • labelSuffix

        @Parameter(defaultValue=" Developer Resources")
        private java.lang.String labelSuffix
        Deprecated, for removal: This API element is subject to removal in a future version.
        Source feature label suffix. Unless explicitly provided in sourceTemplateFeature/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
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use this to explicitly set the branding plugin attribute of the generated source feature (overrides reuseBrandingPlugin).
      • reuseBrandingPlugin

        @Parameter(defaultValue="true")
        private boolean reuseBrandingPlugin
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Deprecated, for removal: This API element is subject to removal in a future version.
      • session

        @Parameter(property="session",
                   readonly=true)
        private org.apache.maven.execution.MavenSession session
        Deprecated, for removal: This API element is subject to removal in a future version.
      • excludedPlugins

        private final java.util.Set<java.lang.String> excludedPlugins
        Deprecated, for removal: This API element is subject to removal in a future version.
      • excludedFeatures

        private final java.util.Set<java.lang.String> excludedFeatures
        Deprecated, for removal: This API element is subject to removal in a future version.
      • extraPlugins

        private final java.util.Set<PluginRef> extraPlugins
        Deprecated, for removal: This API element is subject to removal in a future version.
      • archive

        @Parameter
        private org.apache.maven.archiver.MavenArchiveConfiguration archive
        Deprecated, for removal: This API element is subject to removal in a future version.
      • finalName

        @Parameter(property="project.build.finalName")
        private java.lang.String finalName
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Deprecated, for removal: This API element is subject to removal in a future version.
      • projectHelper

        @Component
        private org.apache.maven.project.MavenProjectHelper projectHelper
        Deprecated, for removal: This API element is subject to removal in a future version.
      • licenseFeatureHelper

        @Component
        private LicenseFeatureHelper licenseFeatureHelper
        Deprecated, for removal: This API element is subject to removal in a future version.
      • buildPropertiesParser

        @Component
        private BuildPropertiesParser buildPropertiesParser
        Deprecated, for removal: This API element is subject to removal in a future version.
      • equinox

        @Component
        private EquinoxServiceFactory equinox
        Deprecated, for removal: This API element is subject to removal in a future version.
      • logger

        @Component
        private org.codehaus.plexus.logging.Logger logger
        Deprecated, for removal: This API element is subject to removal in a future version.
    • Constructor Detail

      • SourceFeatureMojo

        public SourceFeatureMojo()
        Deprecated, for removal: This API element is subject to removal in a future version.
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • getSourcesFeatureOutputDir

        static java.io.File getSourcesFeatureOutputDir​(org.apache.maven.project.MavenProject project)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • mergeFeatureProperties

        private java.util.Properties mergeFeatureProperties​(java.util.Properties sourceFeatureTemplateProps)
                                                     throws java.io.IOException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Throws:
        java.io.IOException
      • readSourceTemplateFeatureProperties

        private java.util.Properties readSourceTemplateFeatureProperties()
                                                                  throws java.io.IOException
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Deprecated, for removal: This API element is subject to removal in a future version.
        Throws:
        java.io.IOException
        org.apache.maven.plugin.MojoExecutionException
      • getMergedSourceFeaturePropertiesFile

        private java.io.File getMergedSourceFeaturePropertiesFile()
        Deprecated, for removal: This API element is subject to removal in a future version.
      • readPropertiesIfExists

        private static java.util.Properties readPropertiesIfExists​(java.io.File propertiesFile)
                                                            throws java.io.IOException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Throws:
        java.io.IOException
      • writeProperties

        private static void writeProperties​(java.util.Properties props,
                                            java.io.File propertiesFile)
                                     throws java.io.IOException
        Deprecated, for removal: This API element is subject to removal in a future version.
        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
        Deprecated, for removal: This API element is subject to removal in a future version.
        This only create the new feature skeleton by setting labels and other not-structural values that don't require platform resolution.
        Throws:
        java.io.IOException
        org.apache.maven.plugin.MojoExecutionException
      • validateValue

        private static java.lang.String validateValue​(java.lang.String fieldValue,
                                                      java.util.Properties sourceFeatureProperties)
                                               throws org.apache.maven.plugin.MojoExecutionException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns 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
        Deprecated, for removal: This API element is subject to removal in a future version.
        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)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • addPlugin

        protected void addPlugin​(Feature sourceFeature,
                                 P2ResolutionResult result,
                                 PluginRef pluginRef)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • getOutputJarFile

        protected java.io.File getOutputJarFile()
        Deprecated, for removal: This API element is subject to removal in a future version.
      • setExcludes

        public void setExcludes​(org.codehaus.plexus.configuration.PlexusConfiguration excludes)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • setPlugins

        public void setPlugins​(org.codehaus.plexus.configuration.PlexusConfiguration bundles)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • getAttribute

        private java.lang.String getAttribute​(org.codehaus.plexus.configuration.PlexusConfiguration dom,
                                              java.lang.String attrName)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • getManuallyIncludedFiles

        private org.codehaus.plexus.archiver.FileSet getManuallyIncludedFiles​(java.io.File basedir,
                                                                              BuildProperties buildProperties)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        A FileSet including 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)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        a FileSet with the given includes and excludes and the configured default excludes. An empty list of includes leads to an empty file set.