mavenscpwagon

remote Maven repository.xml has a invalid uri after scp from local


I have a pom.xml like below, but the repository.xml on scp://myserver/home/myname/bundles has a wrong uri like below which is expected "/home/myname/bundles/..." :

<resource id='com.mycompany.mybundle/0.0.1' symbolicname='com.mycompany.mybundle' presentationname='mybundle' 
uri='file:/C:/Users/Myname/AppData/Local/Temp/com/mycompany/mybundle/0.0.1/mybundle-0.0.1.jar' version='0.0.1'>

My local machine is windows7 and I am using pscp.exe to connect the remote ubuntu linux machine. Could you please tell me how to produce correct uri? Thanks!

c:\>mvn -version
Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
Maven home: D:\sdk\apache-maven-3.0.3
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: D:\sdk\jdk1.6.0_25\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<version>0.0.1</version>
<artifactId>myproject</artifactId>
<packaging>pom</packaging>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.apache.felix</groupId>
        <artifactId>org.apache.felix.framework</artifactId>
        <version>3.0.1</version>
        <type>bundle</type>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId> 
            <artifactId>wagon-ssh</artifactId> 
            <version>1.0</version> 
        </extension> 
    </extensions>
</build>

<modules>
    <module>mybundle</module>
</modules>
<distributionManagement>
    <repository>
        <id>myserver</id>
        <name>myserver</name>
        <url>scp://myserver/home/myname/bundles</url>
    </repository>
</distributionManagement>
</project>

Solution

  • I solved this problem by adding <prefixUrl> in the configuration part of plugin maven-bundle-plugin, like code below:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    ......
                    <remoteOBR>myproject</remoteOBR>
                    <prefixUrl>file:///home/myname/bundles</prefixUrl>
                </configuration>
            </plugin>
        </plugins>
    </build>