@Mojo(name="source-feature",
defaultPhase=PACKAGE)
public class SourceFeatureMojo
extends org.apache.maven.plugin.AbstractMojo
eclipse-feature
. By
default, the generated source feature
<originalFeatureId>.source
"<originalFeatureLabel> Developer Resources"
.source
appended to each plugin id.source
appended to each feature idsourceTemplateFeature/
. 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
.Modifier and Type | Field and Description |
---|---|
private org.apache.maven.archiver.MavenArchiveConfiguration |
archive |
private java.lang.String |
brandingPlugin
Use this to explicitly set the branding plugin attribute of the generated source feature (overrides
reuseBrandingPlugin ). |
private org.eclipse.sisu.equinox.EquinoxServiceFactory |
equinox |
private java.util.Set<java.lang.String> |
excludedFeatures |
private java.util.Set<java.lang.String> |
excludedPlugins |
private org.codehaus.plexus.configuration.PlexusConfiguration |
excludes
Bundles and features that do not have corresponding sources.
|
private java.util.Set<org.eclipse.tycho.model.PluginRef> |
extraPlugins |
private static java.lang.String |
FEATURE_PROPERTIES |
static java.lang.String |
FEATURE_TEMPLATE_DIR |
private java.lang.String |
finalName
The filename to be used for the generated archive file.
|
private static java.lang.String |
GEN_DIR |
private boolean |
includeBinaryFeature
Whether to add an include dependency from the source feature to the corresponding binary
feature.
|
private org.codehaus.plexus.archiver.jar.JarArchiver |
jarArchiver |
private java.lang.String |
labelSuffix
Source feature label suffix.
|
private org.eclipse.tycho.packaging.LicenseFeatureHelper |
licenseFeatureHelper |
private org.codehaus.plexus.logging.Logger |
logger |
private org.codehaus.plexus.configuration.PlexusConfiguration |
plugins
Additional plugins to include in the generated source feature.
|
private org.apache.maven.project.MavenProject |
project |
private org.apache.maven.project.MavenProjectHelper |
projectHelper |
private boolean |
reuseBrandingPlugin
Whether to reuse an explicit branding plugin from the binary feature for the generated source
feature.
|
private org.apache.maven.execution.MavenSession |
session |
private boolean |
skip
Whether to skip source feature generation.
|
static java.lang.String |
SOURCES_FEATURE_CLASSIFIER |
Constructor and Description |
---|
SourceFeatureMojo() |
Modifier and Type | Method and Description |
---|---|
protected void |
addPlugin(org.eclipse.tycho.model.Feature sourceFeature,
org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult result,
org.eclipse.tycho.model.PluginRef pluginRef) |
(package private) org.eclipse.tycho.model.Feature |
createSourceFeatureSkeleton(org.eclipse.tycho.model.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.
|
void |
execute() |
private void |
fillReferences(org.eclipse.tycho.model.Feature sourceFeature,
org.eclipse.tycho.model.Feature feature,
org.eclipse.tycho.artifacts.TargetPlatform targetPlatform)
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) |
private java.lang.String |
getAttribute(org.codehaus.plexus.configuration.PlexusConfiguration dom,
java.lang.String attrName) |
private java.io.File |
getMergedSourceFeaturePropertiesFile() |
protected java.io.File |
getOutputJarFile() |
(package private) static java.io.File |
getSourcesFeatureOutputDir(org.apache.maven.project.MavenProject project) |
private java.util.Properties |
mergeFeatureProperties(java.util.Properties sourceFeatureTemplateProps) |
private static java.util.Properties |
readPropertiesIfExists(java.io.File propertiesFile) |
private java.util.Properties |
readSourceTemplateFeatureProperties() |
void |
setExcludes(org.codehaus.plexus.configuration.PlexusConfiguration excludes) |
void |
setPlugins(org.codehaus.plexus.configuration.PlexusConfiguration bundles) |
protected java.lang.String |
toStrictVersionRange(java.lang.String version) |
private static java.lang.String |
validateValue(java.lang.String fieldValue,
java.util.Properties sourceFeatureProperties)
Returns the value for a field.
|
private static void |
writeProperties(java.util.Properties props,
java.io.File propertiesFile) |
public static final java.lang.String FEATURE_TEMPLATE_DIR
public static final java.lang.String SOURCES_FEATURE_CLASSIFIER
private static final java.lang.String FEATURE_PROPERTIES
private static final java.lang.String GEN_DIR
@Parameter(property="project", readonly=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="false") private boolean skip
@Parameter(defaultValue="true") private boolean includeBinaryFeature
true
, this ensures the version of the installed sources matches the
binaries.@Parameter(defaultValue=" Developer Resources") private java.lang.String labelSuffix
sourceTemplateFeature/feature.properties
, this suffix will be appended to the
original feature label to construct the source feature label.@Parameter private java.lang.String brandingPlugin
reuseBrandingPlugin
).@Parameter(defaultValue="true") private boolean reuseBrandingPlugin
@Parameter private org.codehaus.plexus.configuration.PlexusConfiguration excludes
<excludes> <plugin id="plugin.nosource"/> <feature id="feature.nosource"/> </excludes>
@Parameter private org.codehaus.plexus.configuration.PlexusConfiguration plugins
WARNING This experimental parameter may be removed from future source-feature mojo versions without prior notice.
@Parameter(property="session", readonly=true) private org.apache.maven.execution.MavenSession session
private final java.util.Set<java.lang.String> excludedPlugins
private final java.util.Set<java.lang.String> excludedFeatures
private final java.util.Set<org.eclipse.tycho.model.PluginRef> extraPlugins
@Parameter private org.apache.maven.archiver.MavenArchiveConfiguration archive
@Parameter(property="project.build.finalName") private java.lang.String finalName
@Component(role=org.codehaus.plexus.archiver.Archiver.class, hint="jar") private org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
@Component private org.eclipse.tycho.packaging.LicenseFeatureHelper licenseFeatureHelper
@Component private org.eclipse.sisu.equinox.EquinoxServiceFactory equinox
@Component private org.codehaus.plexus.logging.Logger logger
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
static java.io.File getSourcesFeatureOutputDir(org.apache.maven.project.MavenProject project)
private java.util.Properties mergeFeatureProperties(java.util.Properties sourceFeatureTemplateProps) throws java.io.IOException
java.io.IOException
private java.util.Properties readSourceTemplateFeatureProperties() throws java.io.IOException
java.io.IOException
private java.io.File generateSourceFeatureXml(java.util.Properties mergedSourceFeatureProps, java.util.Properties sourceTemplateProps) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
private java.io.File getMergedSourceFeaturePropertiesFile()
private static java.util.Properties readPropertiesIfExists(java.io.File propertiesFile) throws java.io.IOException
java.io.IOException
private static void writeProperties(java.util.Properties props, java.io.File propertiesFile) throws java.io.IOException
java.io.IOException
org.eclipse.tycho.model.Feature createSourceFeatureSkeleton(org.eclipse.tycho.model.Feature feature, java.util.Properties mergedFeatureProperties, java.util.Properties sourceTemplateProperties) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
private static java.lang.String validateValue(java.lang.String fieldValue, java.util.Properties sourceFeatureProperties) throws org.apache.maven.plugin.MojoExecutionException
fieldValue
- sourceFeatureProperties
- org.apache.maven.plugin.MojoExecutionException
private void fillReferences(org.eclipse.tycho.model.Feature sourceFeature, org.eclipse.tycho.model.Feature feature, org.eclipse.tycho.artifacts.TargetPlatform targetPlatform) throws org.apache.maven.plugin.MojoExecutionException
sourceFeature
- feature
- targetPlatform
- org.apache.maven.plugin.MojoExecutionException
protected java.lang.String toStrictVersionRange(java.lang.String version)
protected void addPlugin(org.eclipse.tycho.model.Feature sourceFeature, org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult result, org.eclipse.tycho.model.PluginRef pluginRef)
protected java.io.File getOutputJarFile()
public void setExcludes(org.codehaus.plexus.configuration.PlexusConfiguration excludes)
public void setPlugins(org.codehaus.plexus.configuration.PlexusConfiguration bundles)
private java.lang.String getAttribute(org.codehaus.plexus.configuration.PlexusConfiguration dom, java.lang.String attrName)