Class 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 Detail

      • 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_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 is true and there is a nested jar named foo.jar, all of its sources will go into folder foosrc/. 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 to true (the default), missing build.properties src.includes will cause build failure. If set to false, 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 be finalName- classifier.jar
      • bundleReader

        @Component
        private BundleReader bundleReader
    • Constructor Detail

      • OsgiSourceMojo

        public OsgiSourceMojo()
    • 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 class AbstractSourceJarMojo
        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 class AbstractSourceJarMojo
        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 class AbstractSourceJarMojo
        Returns:
        the wanted classifier, ie sources or test-sources
      • updateSourceManifest

        protected void updateSourceManifest​(org.apache.maven.archiver.MavenArchiveConfiguration mavenArchiveConfiguration)
        Overrides:
        updateSourceManifest in class AbstractSourceJarMojo
      • 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)
      • 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)