0

我有一个如下所示的 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>
4

1 回答 1

0

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

<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>
于 2011-09-09T02:08:15.653 回答