远程Maven repository.xml在本地scp之后有一个无效的uri

时间:2011-09-07 05:09:06

标签: maven scp wagon

我有一个像下面这样的pom.xml,但scp:// myserver / home / myname / bundles上的repository.xml有一个错误的uri,如下所示“/ 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'>

我的本​​地机器是windows7,我使用pscp.exe连接远程ubuntu linux机器。你能告诉我如何生产正确的uri吗?谢谢!

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>

1 个答案:

答案 0 :(得分:0)

我通过在插件maven-bundle-plugin的配置部分添加<prefixUrl>解决了这个问题,如下面的代码所示:

<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>