我已经以这种方式配置了我的settings.xml:
<ivysettings>
<settings defaultResover="archiva">
<credentials host="host" realm="Repository Archiva Managed internal Repository" username="user" passwd="passwd" />
</settings>
<property name="ivy.shared.default.root" value="http://host.it/repository/internal/" override="false"/>
<property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<resolvers>
<chain name="archiva">
<ibiblio name="ibiblio" m2compatible="true"/>
<ibiblio name="archibib" root="http://host.it/repository/internal/" m2compatible="true"/>
</chain>
</resolvers>
<modules>
<module organisation="annogen" name="annogen" resolver="archiva" />
<module organisation="commons-lang" name="commons-lang" resolver="archiva" />
<module organisation="commons-codec" name="commons-codec" resolver="archiva" />
<module organisation="commons-logging" name="commons-logging" resolver="archiva" />
<module organisation="geniogroup.bbi" name="resutil" resolver="archiva" />
</modules>
</ivysettings>
<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]
/ [module] / [revision] / [artifact] -revision。[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。
答案 0 :(得分:1)
这可能是拼写错误吗?您的设置文件名为 ivysettings.xml ,而不是 archivaIvySetting.xml
<target name="resolve" description="--> take dependencies">
<ivy:settings id="dependency" file="archivaIvySetting.xml" />
<ivy:retrieve settingsRef="dependency" />
</target>
我还想指出,当您使用设置文件的非标准位置时,您只需要常春藤设置任务。默认情况下,它在本地查找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>
注意:
<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>
我过度使用了常春藤检索任务,直到我发现将配置与常春藤缓存路径任务相结合的强大功能。
<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>