Ivy解析来自不同设置的依赖项



我已经这样配置了我的settings.xml:

<标题> settings.xml h1> build . xml
<target name="resolve" description="--> take dependencies"> 
     <ivy:settings id="dependency" file="archivaIvySetting.xml" />
     <ivy:retrieve pattern="./lib" />
</target>
<标题>日志
settings loaded (60ms)
[ivy:retrieve]    default CACHE
[ivy:retrieve]    default resolver: null
[ivy:retrieve]    default latest strategy: latest-revision
[ivy:retrieve]    default conflict manager: latest-revision
[ivy:retrieve]    circular dependency strategy: warn
[ivy:retrieve]    validate: true
[ivy:retrieve]    check up2date: true
[ivy:retrieve]    -- 1 resolvers:
[ivy:retrieve]    archiva [ibiblio]
[ivy:retrieve]        cache: null
[ivy:retrieve]        m2compatible: true
[ivy:retrieve]        ivy patterns:
[ivy:retrieve]            http://host.it/repository/internal/[organisation]

/(模块)/(修订)/(工件)的修订。(ext)

[ivy:retrieve]        artifact patterns:
[ivy:retrieve]            http://host.it/repository/internal/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext] 
[ivy:retrieve]        repository: archiva
[ivy:retrieve]        root: http://host.it/repository/internal/
[ivy:retrieve]        pattern: [organisation]/[module]/[revision]/[artifact]- [revision](-[classifier]).[ext] 
[ivy:retrieve]        usepoms: true
[ivy:retrieve]        useMavenMetadata: true
[ivy:retrieve]    module settings:
[ivy:retrieve]        NONE......
.......[ivy:retrieve] post 1.3 ivy file: using exact as default matcher
[ivy:retrieve] :: resolving dependencies :: geniogroup.bbi#bpsxml;1.0
[ivy:retrieve]    confs: [default]
[ivy:retrieve]    validate = true
[ivy:retrieve]    refresh = false
[ivy:retrieve] resolving dependencies for configuration 'default'
[ivy:retrieve] == resolving dependencies for.....
.......[ivy:retrieve] :::: ERRORS
[ivy:retrieve]    unknown resolver null
[ivy:retrieve]    no resolver found for annogen#annogen: check your configuration

我不明白有什么问题,我写了一个解析器,我已经为检索任务设置了我的设置,但似乎它没有读取解析器,有什么问题吗?

<标题> 更新

在设置中添加模块任务,现在它检索jar文件,但我不明白为什么我不能在我的工作空间中保存jar。

是不是打错了?您的设置文件名为ivysettings.xml而不是 archiivaivysetting .xml

<target name="resolve" description="--> take dependencies"> 
     <ivy:settings id="dependency" file="archivaIvySetting.xml" />
     <ivy:retrieve settingsRef="dependency" />
</target>

我还想指出,只有当您为设置文件使用非标准位置时,才需要ivy设置任务。默认情况下,它在本地查找ivysettings.xml。

<标题> 建议更改

ivysettings.xml

<ivysettings>
    <settings defaultResover="archiva">
        <credentials host="host" realm="Repository Archiva Managed internal Repository" username="user" passwd="passwd" />
    </settings>    
    <resolvers>
        <chain name="archiva">
            <ibiblio name="ibiblio" m2compatible="true"/>
            <ibiblio name="archibib" root="http://host.it/repository/internal/" m2compatible="true"/>
        </chain>
    </resolvers>    
</ivysettings>

指出:

  • 不要重写ivy的默认属性,除非你真的需要。
  • 难道不能让Archiva代理像Maven Central这样的远程存储库吗?这将使设置文件更简单:

.

<ivysettings>
    <settings defaultResover="archiva">
        <credentials host="host" realm="Repository Archiva Managed internal Repository" username="user" passwd="passwd" />
    </settings>    
    <resolvers>
       <ibiblio name="archiva" root="http://host.it/repository/proxy/" m2compatible="true"/>
    </resolvers>    
</ivysettings>

build . xml

我过度使用ivy检索任务,直到我发现将配置与ivy缓存路径任务相结合的强大功能。

    <target name="resolve" depends="install-ivy" description="Use ivy to resolve classpaths">
        <ivy:resolve/>
        <ivy:report todir='${build.dir}/ivy-reports' graph='false' xml='false'/>
        <ivy:cachepath pathid="compile.path" conf="compile"/>
        <ivy:cachepath pathid="test.path"    conf="test"/>
    </target>

检索任务仅在需要将文件保存到构建工作区时才需要。

    <target name="build" depends="test" description="Create executable jar archive">
        <ivy:retrieve pattern="${dist.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" conf="runtime"/>
        <manifestclasspath property="jar.classpath" jarfile="${jar.file}">
            <classpath>
                <fileset dir="${dist.dir}/lib" includes="*.jar"/>
            </classpath>
        </manifestclasspath>
        <jar destfile="${jar.file}" basedir="${build.dir}/classes">
            <manifest>
                <attribute name="Main-Class" value="${jar.main.class}" />
                <attribute name="Class-Path" value="${jar.classpath}" />
            </manifest>
        </jar>
    </target>

相关内容

  • 没有找到相关文章

最新更新