ruby - 为什么 Buildr 失败了?

标签 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无法解析String ["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

最佳答案

您可以发布整个 POM 吗?我打赌你能在别处找到 jar 。

如果非要我猜的话,我会说传递依赖依赖于 JBoss 存储库中的 Artifact 。 JBoss 为各种 Java API 提供了大量洁净室 jar。我敢打赌,您的传递依赖项之一是为此目的使用 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:另一种解决方法,尝试将 JBoss 作为 Repo 添加到您的 ~/.m2/settings.xml 文件中并将其从您的项目 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>

关于ruby - 为什么 Buildr 失败了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8363375/

相关文章:

ruby-on-rails - Rails 非图像文件上传到数据库而不使用服务器端临时文件?

OSX 上的 Rubygems 丢失

ruby-on-rails - 无法使用 Factory Girl 和 rspec 更新关联对象的属性

java - 在 Maven 构建期间未找到外部 jar 中的类文件?

java - Maven - Unresolved 对 [javax.activation, javax.annotation] 的引用

java - 从多模块项目创建 uber-jar

android - Maven编译错误: package R does not exist

ruby - WEBrick 和 Sinatra : how to redirect all http traffic to https

java - 将属性传递给 Maven 子模块,该子模块没有当前模块作为父模块

xml - 如何使用 pom.xml 备份文件?