Deploying a pre-existing bundle on OSGi OBR
Using the maven-bundle-plugin, you can deploy a preexisting jar bundle from your local maven repository to your remote OBR. For this you use the deploy-file
target of the maven-bundle-plugin directly, with a command line like:
mvn org.apache.felix:maven-bundle-plugin:2.4.0:deploy-file
-DrepositoryId=my-repository-id
-Durl=scp://url/to/my/repository
-DpomFile=C:\Users\myuser\.m2\repository\com\...\the-bundle-to-deploy-1.0.0.pom
where my-repository-id
is the id you also use in your settings.xml for storing the access data (username, private key, passphrase etc).
In my case, this simple command failed with the error:
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.4.0:deploy-file (default-cli) on project standalone-pom: Unsupported protocol: 'scp': Cannot find wagon which supports the requested protocol: scp: java.util.NoSuchElementException
[ERROR] role: org.apache.maven.wagon.Wagon
[ERROR] roleHint: scp
and later
Error injecting: org.apache.maven.wagon.providers.ssh.jsch.ScpWagon
and even later
Error injecting: org.apache.maven.wagon.providers.ssh.jsch.interactive.PrompterUIKeyboardInteractive
To resolve this, I had to add the following jars to the %M2_HOME/lib directory (so they are added to the classpath).
- wagon-ssh-2.5.jar
- wagon-ssh-common-2.5.jar
- jsch-0.1.51.jar
- plexus-interactivity-api-1.0-alpha-6.jar
M2_HOME is where the maven executable are located, in my case C:\springsource\apache-maven-3.0.3\lib
and which can be found (on windows) by executing:
where mvn