为什么Buildr失败了?

时间:2011-12-02 22:16:08

标签: ruby maven pom.xml buildr

我的pom.xml中有这个:

<?xml version="1.0" encoding="UTF-8"?>
<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.aaa</groupId>
<artifactId>bbb</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<name>Xxx</name>

<repositories>
    <repository>
        <id>jboss-public-repository-group</id>
        <name>JBoss Public Maven Repository Group</name>
        <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
        <layout>default</layout>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.jboss.aop</groupId>
        <artifactId>jboss-aop</artifactId>
        <version>2.1.8.GA</version>
    </dependency>
</dependencies>

</project>

运行buildr会产生以下结果:

$ buildr -v compile
/usr/local/lib64/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
To use Buildr you need a buildfile. Do you want me to create one?:
1. From Maven2 POM file
2. From directory structure
3. Cancel
?  1
Downloading org.jboss.aop:jboss-aop:pom:2.1.8.GA
Buildr aborted!
URI::InvalidURIError : bad URI(is not URI?): ["https://repository.jboss.org/nexus/content/groups/public-jboss/"]

这显然是因为URI.parse无法解析字符串["https://repository.jboss.org/nexus/content/groups/public-jboss/"],因为它包含方括号和双引号。

有没有办法解决这个问题?

版本是:

$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

$ buildr --version
/usr/local/lib64/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
Buildr 1.4.6

1 个答案:

答案 0 :(得分:1)

你可以张贴整个POM吗?我打赌你可以在其他地方找到罐子。

如果我不得不猜测,我会说传递依赖依赖于JBoss存储库中的工件。 JBoss为各种Java API提供了大量的洁净室。我打赌你的一个传递依赖是为了这个目的使用JBoss jar。

编辑: 为了彻底,在您的Ruby代码中,您使用的是jboss-aop jar中的类吗?

另外,Maven允许我将URL放在CData中...试试这个:

<url><![CDATA[https://repository.jboss.org/nexus/content/groups/public-jboss]]></url>

另外,请尝试禁用https:

<url><![CDATA[http://repository.jboss.org/nexus/content/groups/public-jboss]]></url>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss</url>

编辑#2:另一种解决方法,尝试在您的〜/ .m2 / settings.xml文件中添加JBoss作为Repo并将其从项目pom中删除:

<?xml version="1.0" encoding="UTF-8"?>
<settings
    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/settings-1.0.0.xsd">
    <profiles>
        <profile>
            <id>myprofile</id>
            <repositories>
                <repository>
                    <id>jboss-public-repository-group</id>
                    <name>JBoss Public Maven Repository Group</name>
                    <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>myprofile</activeProfile>
    </activeProfiles>

</settings>