Package org.eclipse.tycho.source
Class OsgiSourceMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.tycho.source.AbstractSourceJarMojo
-
- org.eclipse.tycho.source.OsgiSourceMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="plugin-source", defaultPhase=PREPARE_PACKAGE, threadSafe=true) public class OsgiSourceMojo extends AbstractSourceJarMojo
Goal to create a JAR-package containing all the source files of a osgi project.
-
-
Field Summary
Fields Modifier and Type Field Description private org.codehaus.plexus.archiver.util.DefaultFileSet[]
additionalFileSets
Additional files to be included in the source bundle jar.(package private) BuildPropertiesParser
buildPropertiesParser
private BundleReader
bundleReader
private java.lang.String
classifier
The source bundles classifier.private boolean
distinctSourceRoots
Whether sources for nested jars should be put into distinct source root folders inside the source jar (one source root per nested jar).private static java.lang.String
GOAL
private static java.lang.String
I18N_KEY_BUNDLE_NAME
private static java.lang.String
I18N_KEY_BUNDLE_VENDOR
private static java.lang.String
I18N_KEY_PREFIX
private IncludeValidationHelper
includeValidationHelper
private static java.lang.String
MANIFEST_BUNDLE_LOCALIZATION_BASENAME
private static java.lang.String
MANIFEST_BUNDLE_LOCALIZATION_FILENAME
private static java.lang.String
MANIFEST_HEADER_ECLIPSE_SOURCE_BUNDLE
private java.util.Map<java.lang.String,TychoProject>
projectTypes
private java.lang.String
qualifier
Build qualifier.protected boolean
requireSourceRoots
Whether source folders are required or not.private boolean
sourceBundle
Whether the source jar should be an Eclipse source bundle.private java.lang.String
sourceBundleSuffix
The suffix to be added to the symbolic name of the bundle to construct the symbolic name of the Eclipse source bundle.protected boolean
strictSrcIncludes
If set totrue
(the default), missing build.properties src.includes will cause build failure.protected boolean
useDefaultSourceExcludes
Whether default source excludes for SCM files defined in {@see AbstractScanner#DEFAULTEXCLUDES} should be used.private static java.lang.String
VERSION_QUALIFIER
-
Fields inherited from class org.eclipse.tycho.source.AbstractSourceJarMojo
excludeResources, finalName, includePom, outputDirectory, project, reactorProjects, session
-
-
Constructor Summary
Constructors Constructor Description OsgiSourceMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addSourceBundleManifestEntries(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration)
private static java.util.List<java.lang.String>
asList(java.lang.String[] patterns)
private static org.apache.maven.model.Resource
createResource(java.lang.String directory, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes)
private org.apache.maven.model.Resource
generateL10nFile()
private BuildProperties
getBuildProperties()
protected java.lang.String
getClassifier()
private static org.codehaus.plexus.util.xml.Xpp3Dom
getConfigurationElement(org.codehaus.plexus.util.xml.Xpp3Dom config, java.lang.String name)
private java.lang.String
getEclipseHeaderSourceRoots()
private static java.lang.String
getElementValue(org.codehaus.plexus.util.xml.Xpp3Dom config, java.lang.String name)
private org.osgi.framework.Version
getExpandedVersion(java.lang.String versionStr)
private java.lang.String
getL10nResolvedValue(OsgiManifest manifest, java.lang.String manifestHeaderKey, java.util.Properties l10nProps)
private static java.lang.String
getParameterValue(org.apache.maven.model.PluginExecution execution, java.lang.String name, java.lang.String defaultValue)
protected java.util.List<org.apache.maven.model.Resource>
getResources(org.apache.maven.project.MavenProject p)
private static java.lang.String
getSourceRootTargetPath(java.lang.String jarName)
protected java.util.List<org.apache.maven.model.Resource>
getSources(org.apache.maven.project.MavenProject p)
protected java.util.List<org.apache.maven.model.Resource>
getSources(org.apache.maven.project.MavenProject p, boolean requireSourceRoots, BuildProperties buildProperties)
protected boolean
isRelevantProject(org.apache.maven.project.MavenProject project)
protected static boolean
isRelevantProjectImpl(org.apache.maven.project.MavenProject project, BuildPropertiesParser buildPropertiesParser)
protected java.util.Properties
readL10nProps(OsgiManifest manifest)
protected void
updateSourceManifest(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration)
-
Methods inherited from class org.eclipse.tycho.source.AbstractSourceJarMojo
addDirectory, addDirectory, archiveProjectContent, createArchiver, execute, getExtension, getProject, getType, packageSources, packageSources
-
-
-
-
Field Detail
-
GOAL
private static final java.lang.String GOAL
- See Also:
- Constant Field Values
-
MANIFEST_HEADER_ECLIPSE_SOURCE_BUNDLE
private static final java.lang.String MANIFEST_HEADER_ECLIPSE_SOURCE_BUNDLE
- See Also:
- Constant Field Values
-
MANIFEST_BUNDLE_LOCALIZATION_BASENAME
private static final java.lang.String MANIFEST_BUNDLE_LOCALIZATION_BASENAME
- See Also:
- Constant Field Values
-
MANIFEST_BUNDLE_LOCALIZATION_FILENAME
private static final java.lang.String MANIFEST_BUNDLE_LOCALIZATION_FILENAME
- See Also:
- Constant Field Values
-
I18N_KEY_PREFIX
private static final java.lang.String I18N_KEY_PREFIX
- See Also:
- Constant Field Values
-
I18N_KEY_BUNDLE_VENDOR
private static final java.lang.String I18N_KEY_BUNDLE_VENDOR
- See Also:
- Constant Field Values
-
I18N_KEY_BUNDLE_NAME
private static final java.lang.String I18N_KEY_BUNDLE_NAME
- See Also:
- Constant Field Values
-
VERSION_QUALIFIER
private static final java.lang.String VERSION_QUALIFIER
- See Also:
- Constant Field Values
-
sourceBundle
@Parameter(defaultValue="true") private boolean sourceBundle
Whether the source jar should be an Eclipse source bundle.
-
distinctSourceRoots
@Parameter(defaultValue="false") private boolean distinctSourceRoots
Whether sources for nested jars should be put into distinct source root folders inside the source jar (one source root per nested jar). E.g. if this paramater istrue
and there is a nested jar namedfoo.jar
, all of its sources will go into folderfoosrc/
. Otherwise all sources for all jars, nested or not, will go into the root of the source jar (this is the default as it provides interoperability with maven source jars).
-
sourceBundleSuffix
@Parameter(property="sourceBundleSuffix", defaultValue=".source") private java.lang.String sourceBundleSuffix
The suffix to be added to the symbolic name of the bundle to construct the symbolic name of the Eclipse source bundle.
-
qualifier
@Parameter(property="buildQualifier") private java.lang.String qualifier
Build qualifier. Recommended way to set this parameter is using build-qualifier goal. Only used when creating a source bundle.
-
useDefaultSourceExcludes
@Parameter(defaultValue="true") protected boolean useDefaultSourceExcludes
Whether default source excludes for SCM files defined in {@see AbstractScanner#DEFAULTEXCLUDES} should be used.
-
requireSourceRoots
@Parameter(defaultValue="false", readonly=true) protected boolean requireSourceRoots
Whether source folders are required or not. If not required (the default), projects without source folders/source includes will be silently ignored.
-
strictSrcIncludes
@Parameter(defaultValue="true") protected boolean strictSrcIncludes
If set totrue
(the default), missing build.properties src.includes will cause build failure. If set tofalse
, missing build.properties src.includes will be reported as warnings but the build will not fail.
-
additionalFileSets
@Parameter private org.codehaus.plexus.archiver.util.DefaultFileSet[] additionalFileSets
Additional files to be included in the source bundle jar. This can be used when src.includes in build.properties is not flexible enough , e.g. for files which would otherwise conflict with files in bin.includes
Example:
<additionalFileSets> <fileSet> <directory>${project.basedir}/sourceIncludes/</directory> <includes> <include>**/*</include> </includes> </fileSet> </additionalFileSets>
-
classifier
@Parameter(defaultValue="sources") private java.lang.String classifier
The source bundles classifier. The name of the source bundle will befinalName- classifier.jar
-
projectTypes
@Component(role=TychoProject.class) private java.util.Map<java.lang.String,TychoProject> projectTypes
-
buildPropertiesParser
@Component BuildPropertiesParser buildPropertiesParser
-
includeValidationHelper
@Component private IncludeValidationHelper includeValidationHelper
-
bundleReader
@Component private BundleReader bundleReader
-
-
Method Detail
-
getSources
protected java.util.List<org.apache.maven.model.Resource> getSources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
- Specified by:
getSources
in classAbstractSourceJarMojo
- Parameters:
p
- not null- Returns:
- the compile or test sources
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getSources
protected java.util.List<org.apache.maven.model.Resource> getSources(org.apache.maven.project.MavenProject p, boolean requireSourceRoots, BuildProperties buildProperties) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getResources
protected java.util.List<org.apache.maven.model.Resource> getResources(org.apache.maven.project.MavenProject p) throws org.apache.maven.plugin.MojoExecutionException
- Specified by:
getResources
in classAbstractSourceJarMojo
- Parameters:
p
- not null- Returns:
- the compile or test resources
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
asList
private static java.util.List<java.lang.String> asList(java.lang.String[] patterns)
-
createResource
private static org.apache.maven.model.Resource createResource(java.lang.String directory, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes)
-
generateL10nFile
private org.apache.maven.model.Resource generateL10nFile() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
readL10nProps
protected java.util.Properties readL10nProps(OsgiManifest manifest) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getL10nResolvedValue
private java.lang.String getL10nResolvedValue(OsgiManifest manifest, java.lang.String manifestHeaderKey, java.util.Properties l10nProps) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getClassifier
protected java.lang.String getClassifier()
- Specified by:
getClassifier
in classAbstractSourceJarMojo
- Returns:
- the wanted classifier, ie
sources
ortest-sources
-
updateSourceManifest
protected void updateSourceManifest(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration)
- Overrides:
updateSourceManifest
in classAbstractSourceJarMojo
-
addSourceBundleManifestEntries
private void addSourceBundleManifestEntries(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration)
-
getEclipseHeaderSourceRoots
private java.lang.String getEclipseHeaderSourceRoots()
-
getSourceRootTargetPath
private static java.lang.String getSourceRootTargetPath(java.lang.String jarName)
-
getExpandedVersion
private org.osgi.framework.Version getExpandedVersion(java.lang.String versionStr)
-
isRelevantProject
protected boolean isRelevantProject(org.apache.maven.project.MavenProject project)
- Specified by:
isRelevantProject
in classAbstractSourceJarMojo
-
isRelevantProjectImpl
protected static boolean isRelevantProjectImpl(org.apache.maven.project.MavenProject project, BuildPropertiesParser buildPropertiesParser)
-
getParameterValue
private static java.lang.String getParameterValue(org.apache.maven.model.PluginExecution execution, java.lang.String name, java.lang.String defaultValue)
-
getElementValue
private static java.lang.String getElementValue(org.codehaus.plexus.util.xml.Xpp3Dom config, java.lang.String name)
-
getConfigurationElement
private static org.codehaus.plexus.util.xml.Xpp3Dom getConfigurationElement(org.codehaus.plexus.util.xml.Xpp3Dom config, java.lang.String name)
-
getBuildProperties
private BuildProperties getBuildProperties()
-
-