How do I use a local folder as an ivy repository?

2019-08-29 23:59发布

问题:

What if I have already jars in my project lib folder and I want to use that folder as my repository instead of downloading and install it into my iv2/local folder.

Right now its first downloading jars from maven to my local repository. Some jars are not found in the repository, but I have them in a lib folder and would lie to retrieve them from there.

回答1:

You need to create an ivysettings.xml where you define two resolvers in a chain:

  • FileSystemResolver
  • Maven Repository Resolver

This could look like this (Example from the chain resolver:

<ivysettings>
    <resolvers>

          <chain name="test">
            <filesystem name="1">
              <ivy pattern="${ivy.settings.dir}/lib/[organisation]/[module]/ivys/ivy-[revision].xml"/>
              <artifact pattern="${ivy.settings.dir}/lib/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
            </filesystem>
            <ibiblio name="maven2" m2compatible="true"/>
          </chain>  
    </resolvers>

</ivysettings>

${ivy.settings.dir} is the folder, where your ivysettings.xml is located.

To include / set an ivysettings.xml in your build.xml you need to use the settings task:

<ivy:settings />

or

<ivy:settings file="path_to_file/ivysettings.xml" />


标签: ivy