为什么 Buildr 失败?

发布于 2024-12-19 10:20:28 字数 2755 浏览 4 评论 0原文

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

I've got this in my 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>

running buildr results in this:

$ 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/"]

That's obviously because URI.parse can't parse String ["https://repository.jboss.org/nexus/content/groups/public-jboss/"] because it contains square brackets and double quotes.

Is there any way to fix that?

Versions are:

$ 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦在夏天 2024-12-26 10:20:29

你能发布你的整个 POM 吗?我打赌你可以在其他地方找到这个罐子。

如果我不得不猜测,我会说传递依赖依赖于 JBoss 存储库中的工件。 JBoss 为各种 Java API 托管了大量的 clean room 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 添加为 ~/.m2/settings.xml 文件中的 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>

Can you post your entire POM? I bet you can locate the jar somewhere else.

If I had to guess, I'm going to say a transitive dependency is relying on an artifact from the JBoss repository. JBoss hosts a lot of clean room jars for various Java APIs. I bet one of your transitive dependencies is using the JBoss jars for this purpose.

EDIT:
Just to be thorough, in your Ruby code, are you using classes from the jboss-aop jar?

Also, Maven allows me to put the URL in CData... try this:

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

Also, try disabled https:

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

EDIT #2: Another workaround, try adding JBoss as a Repo in your ~/.m2/settings.xml file and removing it from your project 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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文