我有一个像下面一个pom.xml,但对SCP的的repository.xml:// MYSERVER /家庭/ MYNAME /包有一个错误的URI像下面预计 “/家/ MYNAME /包/ ...” :

<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>
有帮助吗?

解决方案

我通过在插件Maven的捆插件的配置部分添加<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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top