Question

I want to deploy my maven compiled OSGi bundle to my remote OSGi repository. I'm on Windows 7 and use the maven-bundle-plugin (2.3.7) from eclipse. The repository is on linux and is accessed over ssh.

I have configured in settings.xml to use plink and pscp (Putty tools) to do the ssh work. In <distributionManagement> I set the repository url, which starts with scpexe://

The maven-deploy goal works fine and uploads the jar files and metadata.xml to the repository.

Now I also want the OBR metadata to be produced and uploaded. I thus add in the configuration of the maven-bundle-plugin, <remoteOBR>my-repository</remoteOBR> (which is the same ID as the repository in <distributionManagement>.

When executing deploy, (after the maven deploy phase finishes successfully), I get the error.

[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7:deploy (default-deploy) on project bootstrapper: Transfer failed: Exit code: 1 - 'scp' is not recognized as an internal or external command, operable program or batch file.
-> [Help 1]

This means that the maven-bundle-plugin does not use the pscp command as specified in settings.xml, but rather "scp", which is not available on the path.

How can I configure the maven-bundle-plugin to upload the OBR data using PuTTY's pscp?

Was it helpful?

Solution

I eventually found a working solution:

  1. don't use the external ssh tool (PuTTY), but only the maven-internal ssh/scp implementation
  2. thus, use wagon-ssh (not wagon-ssh-external)
  3. add username, private key location and passphrase to settings.xml (sadly, cannot use pageant, but must hardcode my passphrase in settings.xml (beuh) )

So the POM looks like (note, scp:// protocol is used for the url)

<project>
...
  <distributionManagement>
    <repository>
      <id>my-repository</id>
      <url>scp://repo.myserver.com/path/to/repo/</url>
    </repository>
  </distributionManagement>
...
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.3.7</version>
            <extensions>true</extensions>
            <configuration>
                ...
                <remoteOBR>my-repository</remoteOBR>
            </configuration>
        </plugin>
    </plugins>
    <extensions>
          <extension>
            <groupId>org.apache.maven.wagon</groupId>
             <artifactId>wagon-ssh</artifactId>
             <version>2.5</version>
          </extension>
    </extensions>
  </build>
...

And settings.xml (which is located at C:\Users\myUsernameOnWindows\.m2\)

<settings>
  <servers>
    <server>
      <id>my-repository</id>
      <username>myUsernameOnRepo</username>
      <privateKey>C:/path/to/private/key/id_rsa</privateKey>
      <passphrase>myPrivateKeyPassphrase</passphrase>
    </server>
  </servers>
</settings>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top