Package org.apache.maven.shared.osgi
Class DefaultMaven2OsgiConverter
java.lang.Object
org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter
- All Implemented Interfaces:
Maven2OsgiConverter
Default implementation of
Maven2OsgiConverter
- Version:
- $Id: DefaultMaven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
cleanupModifier
(StringBuffer result, String modifier) static String
cleanupVersion
(String version) getBundleFileName
(org.apache.maven.artifact.Artifact artifact) private String
getBundleSymbolicName
(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 String
getGroupIdFromPackage
(File artifactFile) getVersion
(String version) Convert a Maven version into an OSGi compliant versiongetVersion
(org.apache.maven.artifact.Artifact artifact) Convert a Maven version into an OSGi compliant version
-
Field Details
-
FILE_SEPARATOR
-
FUZZY_VERSION
Clean up version parameters. Other builders use more fuzzy definitions of the version syntax. This method cleans up such a version to match an OSGi version.
-
-
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
- if artifactId starts with groupId then the artifactId is removed. eg. org.apache:org.apache.maven.core -> org.apache.maven.core
- Specified by:
getBundleSymbolicName
in interfaceMaven2OsgiConverter
- Parameters:
artifact
-- Returns:
- the Bundle-SymbolicName manifest property
-
getGroupIdFromPackage
-
getBundleFileName
- Specified by:
getBundleFileName
in interfaceMaven2OsgiConverter
-
getVersion
Description copied from interface:Maven2OsgiConverter
Convert a Maven version into an OSGi compliant version- Specified by:
getVersion
in interfaceMaven2OsgiConverter
- Parameters:
artifact
- Maven artifact- Returns:
- the OSGi version
-
getVersion
Description copied from interface:Maven2OsgiConverter
Convert a Maven version into an OSGi compliant version- Specified by:
getVersion
in interfaceMaven2OsgiConverter
- Parameters:
version
- Maven version- Returns:
- the OSGi version
-
cleanupVersion
-
cleanupModifier
-