如何解决配置番石榴错误未找到 [英] how to fix configuration not found in guava error

查看:172
本文介绍了如何解决配置番石榴错误未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解决从本地文件系统的依赖;这样做,我已经写的ivy.xml,ivyconf.xml和build.xml文件。然而,我的剧本DONOT工作和couldnot解决依赖关系,即couldnot找到jar文件。背后是什么问题呢?而且,我该怎么解决呢?

错误

 错误
[常春藤:解析】com.google.guava#番石榴; 17.0:配置中找不到
              com.google.guava#番石榴; 17.0:'公'。这是从要求
              ..运行

项目层次

 项目
  | - - SRC
  | - - LIB
         | - - guava.jar
  | - - 配置
         | - - 蚂蚁
                | - - build.xml文件
         | - - 常春藤
                | - - 的ivy.xml
                | - - ivyconf.xml

ivy.xml文件

 <常春藤模块版本=2.0>
    <配置defaultconfmapping =runtime->公共>
        <的conf NAME =编译知名度=私人/>
        <的conf NAME =罐子
                扩展=编译
                能见度=私有/>        <的conf NAME =运行
                扩展=罐子
                可见=公/>
    < /配置>    <依赖和GT;
        <依赖有机=com.google.guavaNAME =番石榴REV =17.0的conf =runtime->公开/>
    < /依赖和GT;
< /常春藤模块>

最后,ivyconf.xml

 <的conf defaultresolver =本地/>
<&做出决议GT;
        <文件系统的名称=本地>
            <神器模式=$ {} lib.dir / ** / *罐子。/>
        < /文件系统>
< /解析>


解决方案

您常青藤配置文件是无效的(解析器而不是做出决议)。此外你将有依赖版本问题如果JAR文件不包含在文件名的版本。

我的建议是使用下面的常青藤配置文件:

 < ivysettings>
  <设置defaultResolver ='中央'/>
  <&解析器GT;
    < ibiblio上的名字='中央'm2compatible =真/>
    <文件系统的名称=本地>
      <神器模式='$ {} ivy.settings.dir LIB /../../ / [神器]/>
    < /文件系统>
  < /解析器>
  <模块>
    <模块组织=NA解析=本地/>
  < /模块>
< / ivysettings>

您会然后让你声明依赖的选择如下:

 <依赖有机=com.google.guavaNAME =番石榴REV =17.0/><依赖有机=NANAME =番石榴REV =NA的conf =runtime->默认/>

第一个将检索来自 Maven的中央储存库,第二个将检索您的本地文件系统。

请参阅此方法的更多示例如下回答:

希望这有助于。

I have tried to resolve dependencies from local filesystem; to do so, I have wrote ivy.xml, ivyconf.xml and build.xml. However, my scripts donot work and couldnot resolve dependencies i.e. couldnot find jar files. What is the problem behind it? And, how can I solve it?

error

Error
[ivy:resolve] com.google.guava#guava;17.0: configuration not found in
              com.google.guava#guava;17.0: 'public'. It was required from 
              .. runtime

project hierarchy

project
  | - - src
  | - - lib
         | - - guava.jar
  | - - conf
         | - - ant
                | - - build.xml
         | - - ivy
                | - - ivy.xml
                | - - ivyconf.xml

ivy.xml file

<ivy-module version="2.0">
    <configurations defaultconfmapping="runtime->public">
        <conf   name="compile"      visibility="private"/>
        <conf   name="jar"
                extends="compile"       
                visibility="private"/>

        <conf   name="runtime"      
                extends="jar"   
                visibility="public"/>
    </configurations>

    <dependencies>
        <dependency org="com.google.guava"  name="guava"    rev="17.0"  conf="runtime->public"/>
    </dependencies>
</ivy-module>

lastly, ivyconf.xml

<conf   defaultresolver="local"/>
<resolves>
        <filesystem name="local">
            <artifact   pattern="${lib.dir}/**/*.jar" />
        </filesystem>
</resolves>

解决方案

Your ivy configuration file is invalid ("resolvers" not "resolves"). Additionally you're going to have problems with dependency versioning if the jar file does not contain a version in the filename.

My suggestion is to use the following ivy configuration file:

<ivysettings>
  <settings defaultResolver='central' />
  <resolvers>
    <ibiblio name='central' m2compatible='true'/>
    <filesystem name='local'>
      <artifact pattern='${ivy.settings.dir}/../../lib/[artifact]' />
    </filesystem>
  </resolvers>
  <modules>
    <module organisation='NA' resolver='local' />
  </modules>
</ivysettings>

You'll then have a choice of declaring your dependencies as follows:

<dependency org="com.google.guava" name="guava" rev="17.0" />

<dependency org="NA"  name="guava" rev="NA"  conf="runtime->default"/>

The first will retrieve from the Maven central repository, the second will retrieve from your local filesystem.

See the following answers for more examples of this approach:

Hope this helps.

这篇关于如何解决配置番石榴错误未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆