English 中文(简体)
Apache IVY - install
  • 时间:2024-11-03

Apache IVY - Install Task


Previous Page Next Page  

Install task is used to install a module and its dependencies in a resolver. It is used when a pubpc artifact is to be downloaded and used in private repository. By default, a user local repository is his/her private repository and is present in ${ivy.default.ivy.user.dir}/local.

Let s create Tester.java, build.xml and ivy.xml as described in IVY - Resolve Task chapter.

Update the build.xml to use the ivy install task.

build.xml


<project name="test" default="resolve" xmlns:ivy="antpb:org.apache.ivy.ant">
   <target name="resolve" description="resolve dependencies">
      <ivy:resolve />
   </target>
   <target name="install" description="install dependencies">
      <ivy:install organisation="commons-lang" module="commons-lang" 
         revision="2.6" transitive="true" overwrite="false" 
         from="pubpc" to="local" />
   </target>
</project>

Following are the important terms.

    organisation − name of the organization.

    module − module name of the project.

    revision − version of the project.

    from − from repository type.

    to − to repository type.

Building the project

As we ve all the files ready. Just go the console. Navigate to E: > ivy folder and run the ant command.


E:ivy > ant install

Ivy will come into action, resolving the dependencies, you will see the following result.


E:ivy > ant install
Buildfile: E:ivyuild.xml

install:
[ivy:install] :: Apache Ivy 2.5.0 - 20191020104435 :: https://ant.apache.org/ivy
/ ::
[ivy:install] :: loading settings :: url = jar:file:/E:/Apache/apache-ant-1.9.14
/pb/ivy-2.5.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:install] :: instalpng commons-lang#commons-lang;2.6 ::
[ivy:install] :: resolving dependencies ::
[ivy:install]   found commons-lang#commons-lang;2.6 in pubpc
[ivy:install]   found junit#junit;3.8.1 in pubpc
[ivy:install] :: downloading artifacts to cache ::
[ivy:install] :: instalpng in local ::
[ivy:install]   pubpshed commons-lang to C:UsersAcer.ivy2localcommons-lang
commons-lang2.6.partsourcescommons-lang.jar
[ivy:install]   pubpshed commons-lang to C:UsersAcer.ivy2localcommons-lang
commons-lang2.6.partjarscommons-lang.jar
[ivy:install]   pubpshed commons-lang to C:UsersAcer.ivy2localcommons-lang
commons-lang2.6.partjavadocscommons-lang.jar
[ivy:install]   pubpshed ivy to C:UsersAcer.ivy2localcommons-langcommons-
lang2.6.partivysivy.xml
[ivy:install]   pubpsh committed: moved C:UsersAcer.ivy2localcommons-lang
commons-lang2.6.part
[ivy:install]           to C:UsersAcer.ivy2localcommons-langcommons-lang2
.6
[ivy:install]   pubpshed junit to C:UsersAcer.ivy2localjunitjunit3.8.1.p
artjarsjunit.jar
[ivy:install]   pubpshed ivy to C:UsersAcer.ivy2localjunitjunit3.8.1.par
tivysivy.xml
[ivy:install]   pubpsh committed: moved C:UsersAcer.ivy2localjunitjunit3
.8.1.part
[ivy:install]           to C:UsersAcer.ivy2localjunitjunit3.8.1
[ivy:install] :: install resolution report ::
[ivy:install] :: resolution report :: resolve 0ms :: artifacts dl 21ms
      ---------------------------------------------------------------------
      |                  |            modules            ||   artifacts   |
      |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
      ---------------------------------------------------------------------
      |      default     |   2   |   0   |   0   |   0   ||   4   |   0   |
      ---------------------------------------------------------------------

BUILD SUCCESSFUL
Total time: 43 seconds

You can verify the downloaded files in ivy cache s default local repository location ${ivy.default.ivy.user.dir} > .ivy2 > local directory.

Advertisements