Class DefaultMaven2OsgiConverter
java.lang.Object
org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter
- All Implemented Interfaces:
Maven2OsgiConverter
Default implementation of
Maven2OsgiConverter- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Patternprivate static final Patternprivate static final Stringprivate static final Patternprivate static final Patternpattern that matches strings that contain only numbersprivate static final PatternBundle-Version must match this pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBundleFileName(org.apache.maven.artifact.Artifact artifact) private StringgetBundleSymbolicName(String groupId, String artifactId) getBundleSymbolicName(org.apache.maven.artifact.Artifact artifact) Get the symbolic name as groupId + "." + artifactId, with the following exceptions if artifact.getFile is not null and the jar contains a OSGi Manifest with Bundle-SymbolicName property then that value is returned if groupId has only one section (no dots) and artifact.getFile is not null then the first package name with classes is returned.private StringgetGroupIdFromPackage(File artifactFile) getVersion(String version) Convert a Maven version into an OSGi compliant versionprivate StringgetVersion(String major, String minor, String service, String qualifier) getVersion(org.apache.maven.artifact.Artifact artifact) Convert a Maven version into an OSGi compliant version
-
Field Details
-
OSGI_VERSION_PATTERN
Bundle-Version must match this pattern -
ONLY_NUMBERS
pattern that matches strings that contain only numbers -
DATED_SNAPSHOT
-
DOTS_IN_QUALIFIER
-
NEED_TO_FILL_ZEROS
-
FILE_SEPARATOR
-
-
Constructor Details
-
DefaultMaven2OsgiConverter
public DefaultMaven2OsgiConverter()
-
-
Method Details
-
getBundleSymbolicName
-
getBundleSymbolicName
Get the symbolic name as groupId + "." + artifactId, with the following exceptions- if artifact.getFile is not null and the jar contains a OSGi Manifest with Bundle-SymbolicName property then that value is returned
- if groupId has only one section (no dots) and artifact.getFile is not null then the first package name with classes is returned. eg. commons-logging:commons-logging -> org.apache.commons.logging
- if artifactId is equal to last section of groupId then groupId is returned. eg. org.apache.maven:maven -> org.apache.maven
- if artifactId starts with last section of groupId that portion is removed. eg. org.apache.maven:maven-core -> org.apache.maven.core
- Specified by:
getBundleSymbolicNamein interfaceMaven2OsgiConverter- Parameters:
artifact-- Returns:
- the Bundle-SymbolicName manifest property
-
getGroupIdFromPackage
-
getBundleFileName
- Specified by:
getBundleFileNamein interfaceMaven2OsgiConverter
-
getVersion
Description copied from interface:Maven2OsgiConverterConvert a Maven version into an OSGi compliant version- Specified by:
getVersionin interfaceMaven2OsgiConverter- Parameters:
artifact- Maven artifact- Returns:
- the OSGi version
-
getVersion
Description copied from interface:Maven2OsgiConverterConvert a Maven version into an OSGi compliant version- Specified by:
getVersionin interfaceMaven2OsgiConverter- Parameters:
version- Maven version- Returns:
- the OSGi version
-
getVersion
-