You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2007/02/04 22:05:45 UTC
svn commit: r503484 - in /maven/sandbox/plugins/maven-bundle-plugin: ./
src/main/java/org/apache/felix/tools/maven2/bundleplugin/ src/test/
src/test/java/ src/test/java/org/ src/test/java/org/apache/
src/test/java/org/apache/felix/ src/test/java/org/ap...
Author: carlos
Date: Sun Feb 4 13:05:44 2007
New Revision: 503484
URL: http://svn.apache.org/viewvc?view=rev&rev=503484
Log:
Add version conversion Maven -> OSGi
Add recursivebundle goal to convert a tree of dependencies to OSGi bundles
Added:
maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java (with props)
maven/sandbox/plugins/maven-bundle-plugin/src/test/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/
maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java (with props)
Modified:
maven/sandbox/plugins/maven-bundle-plugin/pom.xml
maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
Modified: maven/sandbox/plugins/maven-bundle-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/pom.xml?view=diff&rev=503484&r1=503483&r2=503484
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/pom.xml (original)
+++ maven/sandbox/plugins/maven-bundle-plugin/pom.xml Sun Feb 4 13:05:44 2007
@@ -71,5 +71,16 @@
<artifactId>maven-artifact</artifactId>
<version>2.0</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-dependency-tree</artifactId>
+ <version>1.0-alpha-2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <version>1.0-beta-1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java?view=diff&rev=503484&r1=503483&r2=503484
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java (original)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java Sun Feb 4 13:05:44 2007
@@ -40,6 +40,15 @@
*/
public class BundlePlugin extends AbstractMojo {
+ /** Bundle-Version must match this pattern */
+ private static final Pattern OSGI_VERSION_PATTERN = Pattern.compile("[0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9A-Za-z_-]+)?)?)?");
+
+ /** pattern used to change - to . */
+ //private static final Pattern P_VERSION = Pattern.compile("([0-9]+(\\.[0-9])*)-(.*)");
+
+ /** pattern that matches strings that contain only numbers */
+ private static final Pattern ONLY_NUMBERS = Pattern.compile("[0-9]+");
+
/**
* @parameter expression="${project.build.outputDirectory}"
* @required
@@ -80,25 +89,34 @@
private Map instructions = new HashMap();
public void execute() throws MojoExecutionException {
+ Properties properties = new Properties();
+
+ if (new File(baseDir, "src/main/resources").exists()) {
+ header(properties, Analyzer.INCLUDE_RESOURCE, "src/main/resources/");
+ }
+
try {
- File jarFile = new File(buildDirectory, project.getBuild()
- .getFinalName()
- + ".jar");
-
+ execute(project, instructions, properties, getClasspath(project));
+ }
+ catch ( IOException e ) {
+ throw new MojoExecutionException("Error calculating classpath for project " + project, e);
+ }
+ }
+
+ protected void execute(MavenProject project, Map instructions, Properties properties, Jar[] classpath) throws MojoExecutionException {
+ try {
+ File jarFile = new File(buildDirectory, getBundleName(project));
+
// Setup defaults
String bsn = project.getGroupId() + "." + project.getArtifactId();
- Properties properties = new Properties();
properties.put(Analyzer.BUNDLE_SYMBOLICNAME, bsn);
properties.put(Analyzer.IMPORT_PACKAGE, "*");
if (!instructions.containsKey(Analyzer.PRIVATE_PACKAGE)) {
properties.put(Analyzer.EXPORT_PACKAGE, bsn + ".*");
}
- String version = project.getVersion();
- Pattern P_VERSION = Pattern.compile("([0-9]+(\\.[0-9])*)-(.*)");
- Matcher m = P_VERSION.matcher(version);
- if (m.matches()) {
- version = m.group(1) + "." + m.group(3);
- }
+
+ String version = convertVersionToOsgi(project.getVersion());
+
properties.put(Analyzer.BUNDLE_VERSION, version);
header(properties, Analyzer.BUNDLE_DESCRIPTION, project
.getDescription());
@@ -115,15 +133,11 @@
}
}
- if (new File(baseDir, "src/main/resources").exists()) {
- header(properties, Analyzer.INCLUDE_RESOURCE, "src/main/resources/");
- }
-
properties.putAll(project.getProperties());
properties.putAll(project.getModel().getProperties());
- properties.putAll( getProperies("project.build.", project.getBuild()));
- properties.putAll( getProperies("pom.", project.getModel()));
- properties.putAll( getProperies("project.", project));
+ properties.putAll( getProperies(project.getModel(), "project.build.", project.getBuild()));
+ properties.putAll( getProperies(project.getModel(), "pom.", project.getModel()));
+ properties.putAll( getProperies(project.getModel(), "project.", project));
properties.put("project.baseDir", baseDir );
properties.put("project.build.directory", buildDirectory );
properties.put("project.build.outputdirectory", outputDirectory );
@@ -132,13 +146,12 @@
Builder builder = new Builder();
builder.setBase(baseDir);
- Jar[] cp = getClasspath();
builder.setProperties(properties);
- builder.setClasspath(cp);
+ builder.setClasspath(classpath);
builder.build();
Jar jar = builder.getJar();
- doMavenMetadata(jar);
+ doMavenMetadata(project, jar);
builder.setJar(jar);
List errors = builder.getErrors();
@@ -148,7 +161,7 @@
jarFile.delete();
for (Iterator e = errors.iterator(); e.hasNext();) {
String msg = (String) e.next();
- getLog().error(msg);
+ getLog().error("Error building bundle " + project.getArtifact() + " : " + msg);
}
throw new MojoFailureException("Found errors, see log");
}
@@ -159,7 +172,7 @@
}
for (Iterator w = warnings.iterator(); w.hasNext();) {
String msg = (String) w.next();
- getLog().warn(msg);
+ getLog().warn("Warning building bundle " + project.getArtifact() + " : " + msg);
}
}
@@ -169,14 +182,14 @@
}
}
- private Map getProperies(String prefix, Object model) {
+ private Map getProperies(Model projectModel, String prefix, Object model) {
Map properties = new HashMap();
Method methods[] = Model.class.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
String name = methods[i].getName();
if ( name.startsWith("get") ) {
try {
- Object v = methods[i].invoke(project.getModel(), null );
+ Object v = methods[i].invoke(projectModel, null );
if ( v != null ) {
name = prefix + Character.toLowerCase(name.charAt(3)) + name.substring(4);
if ( v.getClass().isArray() )
@@ -213,7 +226,7 @@
* @param jar
* @throws IOException
*/
- private void doMavenMetadata(Jar jar) throws IOException {
+ private void doMavenMetadata(MavenProject project, Jar jar) throws IOException {
String path = "META-INF/maven/" + project.getGroupId() + "/"
+ project.getArtifactId();
File pomFile = new File(baseDir, "pom.xml");
@@ -234,7 +247,7 @@
* @throws ZipException
* @throws IOException
*/
- private Jar[] getClasspath() throws ZipException, IOException {
+ private Jar[] getClasspath(MavenProject project) throws ZipException, IOException {
List list = new ArrayList();
if (outputDirectory != null && outputDirectory.exists()) {
@@ -264,5 +277,103 @@
return;
properties.put(key, value.toString());
+ }
+
+ /**
+ * Convert a Maven version into an OSGi compliant version
+ *
+ * @param version Maven version
+ * @return the OSGi version
+ */
+ protected String convertVersionToOsgi(String version)
+ {
+ String osgiVersion;
+
+// Matcher m = P_VERSION.matcher(version);
+// if (m.matches()) {
+// osgiVersion = m.group(1) + "." + m.group(3);
+// }
+
+ /* TODO need a regexp guru here */
+
+ Matcher m;
+
+ /* if it's already OSGi compliant don't touch it */
+ m = OSGI_VERSION_PATTERN.matcher(version);
+ if (m.matches()) {
+ return version;
+ }
+
+ /* else transform first - to . and others to _ */
+ osgiVersion = version.replaceFirst( "-", "\\." );
+ osgiVersion = osgiVersion.replaceAll( "-", "_" );
+ m = OSGI_VERSION_PATTERN.matcher(osgiVersion);
+ if (m.matches()) {
+ return osgiVersion;
+ }
+
+ /* remove dots in the middle of the qualifier */
+ Pattern DOTS_IN_QUALIFIER = Pattern.compile("([0-9])(\\.[0-9])?\\.([0-9A-Za-z_-]+)\\.([0-9A-Za-z_-]+)");
+ m = DOTS_IN_QUALIFIER.matcher(osgiVersion);
+ if (m.matches()) {
+ String s1 = m.group(1);
+ String s2 = m.group(2);
+ String s3 = m.group(3);
+ String s4 = m.group(4);
+
+ Matcher qualifierMatcher = ONLY_NUMBERS.matcher( s3 );
+ /* if last portion before dot is only numbers then it's not in the middle of the qualifier */
+ if (!qualifierMatcher.matches()) {
+ osgiVersion = s1 + s2 + "." + s3 + "_" + s4;
+ }
+ }
+
+ /* convert 1.string into 1.0.0.string */
+ Pattern ONE_NUMBER = Pattern.compile("([0-9])\\.([0-9A-Za-z_-]+)");
+ m = ONE_NUMBER.matcher(osgiVersion);
+ if (m.matches()) {
+ String major = m.group(1);
+ String minor = "0";
+ String service = "0";
+ String qualifier = m.group(2);
+
+ Matcher qualifierMatcher = ONLY_NUMBERS.matcher( qualifier );
+ /* if last portion is only numbers then it's not a qualifier */
+ if (!qualifierMatcher.matches()) {
+ osgiVersion = major + "." + minor + "." + service + "." + qualifier;
+ }
+ }
+
+ /* convert 1.2.string into 1.2.0.string */
+ Pattern TWO_NUMBER = Pattern.compile("([0-9])\\.([0-9])\\.([0-9A-Za-z_-]+)");
+ m = TWO_NUMBER.matcher(osgiVersion);
+ if (m.matches()) {
+ String major = m.group(1);
+ String minor = m.group(2);
+ String service = "0";
+ String qualifier = m.group(3);
+
+ Matcher qualifierMatcher = ONLY_NUMBERS.matcher( qualifier );
+ /* if last portion is only numbers then it's not a qualifier */
+ if (!qualifierMatcher.matches()) {
+ osgiVersion = major + "." + minor + "." + service + "." + qualifier;
+ }
+ }
+
+ m = OSGI_VERSION_PATTERN.matcher(osgiVersion);
+ /* if still its not OSGi version then add everything as qualifier */
+ if (!m.matches()) {
+ String major = "0";
+ String minor = "0";
+ String service = "0";
+ String qualifier = osgiVersion.replaceAll( "\\.", "_" );
+ osgiVersion = major + "." + minor + "." + service + "." + qualifier;
+ }
+
+ return osgiVersion;
+ }
+
+ protected String getBundleName(MavenProject project) {
+ return project.getBuild().getFinalName() + ".jar";
}
}
Added: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java?view=auto&rev=503484
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java (added)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java Sun Feb 4 13:05:44 2007
@@ -0,0 +1,251 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.tools.maven2.bundleplugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactCollector;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyTree;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+
+import sun.tools.jar.resources.jar;
+
+import aQute.lib.osgi.Analyzer;
+import aQute.lib.osgi.Jar;
+
+/**
+ *
+ * @goal recursivebundle
+ * @phase package
+ * @requiresDependencyResolution runtime
+ * @description build an OSGi bundle jar for all transitive dependencies
+ */
+public class RecursiveBundlePlugin
+ extends BundlePlugin
+{
+
+ /**
+ * The Maven Project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * Local Repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @required
+ * @readonly
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * Remote repositories
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @required
+ * @readonly
+ */
+ private List remoteRepositories;
+
+ /**
+ * @component
+ */
+ private ArtifactFactory factory;
+
+ /**
+ * @component
+ */
+ private ArtifactMetadataSource artifactMetadataSource;
+
+ /**
+ * @component
+ */
+ private ArtifactCollector collector;
+
+ /**
+ * @component
+ */
+ private DependencyTreeBuilder dependencyTreeBuilder;
+
+ /**
+ * @component
+ */
+ private ArtifactMetadataSource metadataSource;
+
+ /**
+ * @component
+ */
+ private MavenProjectBuilder mavenProjectBuilder;
+
+ private Map mapOfArtifacts;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ DependencyTree dependencyTree;
+
+ try
+ {
+ dependencyTree = dependencyTreeBuilder.buildDependencyTree( project, localRepository, factory,
+ artifactMetadataSource, collector );
+ }
+ catch ( DependencyTreeBuilderException e )
+ {
+ throw new MojoExecutionException( "Unable to build dependency tree", e );
+ }
+
+ DependencyNode rootNode = dependencyTree.getRootNode();
+
+ mapOfArtifacts = createMapOfArtifacts( project );
+
+ bundle( rootNode );
+ }
+
+ private void bundle( DependencyNode node )
+ throws MojoExecutionException
+ {
+ List children = node.getChildren();
+ if ( ( children == null ) || children.isEmpty() )
+ {
+ return;
+ }
+
+ Iterator it = children.iterator();
+ while ( it.hasNext() )
+ {
+ DependencyNode child = (DependencyNode) it.next();
+ Artifact artifact = child.getArtifact();
+
+ /* skip non compile or runtime artifacts */
+ if ( !( Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) || Artifact.SCOPE_RUNTIME.equals( artifact
+ .getScope() ) ) )
+ {
+ continue;
+ }
+
+ // ResolutionGroup resolutionGroup;
+ // try
+ // {
+ // resolutionGroup = metadataSource.retrieve( artifact, localRepository, remoteRepositories );
+ // }
+ // catch ( ArtifactMetadataRetrievalException e )
+ // {
+ // throw new MojoExecutionException( "Unable to retrieve metadata for: " + artifact, e );
+ // }
+
+ MavenProject project;
+ try
+ {
+ project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository, true );
+ }
+ catch ( ProjectBuildingException e )
+ {
+ throw new MojoExecutionException( "Unable to build project object for artifact " + artifact, e );
+ }
+
+ // for ( Iterator it2 = resolutionGroup.getArtifacts().iterator(); it2.hasNext(); )
+ // {
+ // Artifact a = (Artifact) it2.next();
+ // System.out.println( a.getArtifactId() + " " + a.getFile());
+ //
+ // }
+
+ /* process the node */
+ Map instructions = new HashMap();
+ instructions.put( Analyzer.EXPORT_PACKAGE, "*" );
+ execute( project, instructions, artifact );
+
+ bundle( child );
+ }
+ }
+
+ private void execute( MavenProject project, Map instructions, Artifact artifact )
+ throws MojoExecutionException
+ {
+ Properties properties = new Properties();
+ try
+ {
+ execute( project, instructions, properties, new Jar[] { getJar( artifact ) } );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error calculating classpath for project " + project, e );
+ }
+ }
+
+ private Map createMapOfArtifacts( MavenProject project )
+ {
+ Set artifacts = project.getArtifacts();
+ Map map = new HashMap();
+ for ( Iterator it = artifacts.iterator(); it.hasNext(); )
+ {
+ Artifact artifact = (Artifact) it.next();
+ map.put( getArtifactKey( artifact ), artifact );
+ }
+ return map;
+ }
+
+ private Jar getJar( Artifact artifact )
+ throws IOException
+ {
+ Artifact a = (Artifact) mapOfArtifacts.get( getArtifactKey( artifact ) );
+ if ((a == null ) )
+ {
+ throw new RuntimeException( "The artifact " + artifact + " from the dependency tree is not in the dependency set" );
+ }
+ String name = a.getArtifactId();
+ File jarFile = a.getFile();
+ if ((name == null ) || (jarFile == null ))
+ {
+ throw new RuntimeException( "The artifact " + artifact + " has no name or file couldn't be determined" );
+ }
+ return new Jar( name, jarFile );
+ }
+
+ private String getArtifactKey( Artifact artifact )
+ {
+ return artifact.getGroupId() + ":" + artifact.getArtifactId();
+ }
+
+ protected String getBundleName( MavenProject project )
+ {
+ return project.getGroupId() + "." + project.getArtifactId() + "_" + convertVersionToOsgi(project.getVersion()) + ".jar";
+ }
+}
Propchange: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/RecursiveBundlePlugin.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java?view=auto&rev=503484
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java (added)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java Sun Feb 4 13:05:44 2007
@@ -0,0 +1,71 @@
+package org.apache.felix.tools.maven2.bundleplugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+/**
+ * Test for {@link BundlePlugin}.
+ *
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class BundlePluginTest
+ extends TestCase
+{
+
+ BundlePlugin plugin = new BundlePlugin();
+
+ public void testConvertVersionToOsgi()
+ {
+ String osgiVersion;
+
+ osgiVersion = plugin.convertVersionToOsgi( "2.1.0-SNAPSHOT" );
+ assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "2.1-SNAPSHOT" );
+ assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "2-SNAPSHOT" );
+ assertEquals( "2.0.0.SNAPSHOT", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "2" );
+ assertEquals( "2", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "2.1" );
+ assertEquals( "2.1", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "2.1.3" );
+ assertEquals( "2.1.3", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "2.1.3.4" );
+ assertEquals( "2.1.3.4", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "4aug2000r7-dev" );
+ assertEquals( "0.0.0.4aug2000r7_dev", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "1.1-alpha-2" );
+ assertEquals( "1.1.0.alpha_2", osgiVersion );
+
+ osgiVersion = plugin.convertVersionToOsgi( "1.0-alpha-16-20070122.203121-13" );
+ assertEquals( "1.0.0.alpha_16_20070122_203121_13", osgiVersion );
+ }
+
+}
Propchange: maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"