原创作者: Sky Ao   阅读:1858次   评论:0条   更新时间:2011-05-26    

1) 单独使用

    ivy可以非常容易的作为一个单独的程序使用。你所需要的只是一个java1.4+的运行环境(JRE)!

    这是如何调用它的例子:

java  - jar ivy.jar  -?


    它将实现类似这样的在线帮助:

==== settings options
 -settings 
< settingsfile >      use given file for settings
 -cache 
< cachedir >             use given directory for cache
 -novalidate                  do not validate ivy files against xsd
 -m2compatible                use maven2 compatibility

==== resolve options
 -ivy 
< ivyfile >                use given file as ivy file
 -dependency 
< organisation >   < module >   < revision >
                              use this instead of ivy file to do the rest of the
                               work with this as a dependency.
 -confs 
< configurations >       resolve given configurations

==== retrieve options
 -retrieve 
< retrievepattern >   use given pattern as retrieve pattern
 -sync                        use sync mode for retrieve

==== cache path options
 -cachepath 
< cachepathfile >    outputs a classpath consisting of all dependencies
                               in cache (including transitive ones) of the given
                               ivy file to the given cachepathfile

==== deliver options
 -deliverto 
< ivypattern >       use given pattern as resolved ivy file pattern

==== publish options
 -publish 
< resolvername >       use given resolver to publish to
 -publishpattern 
< artpattern >  use given pattern to find artifacts to publish
 -revision 
< revision >          use given revision to publish the module
 -status 
< status >              use given status to publish the module

==== http auth options
 -realm 
< realm >                use given realm for HTTP AUTH
 -host 
< host >                  use given host for HTTP AUTH
 -username 
< username >          use given username for HTTP AUTH
 -passwd 
< passwd >              use given password for HTTP AUTH

==== launcher options
 -main 
< main >                  the FQCN of the main class to launch
 -args 
< args >                  the arguments to give to the launched process
 -cp 
< cp >                      extra classpath to use when launching process

==== message options
 -debug                       set message level to debug
 -verbose                     set message level to verbose
 -warn                        set message level to warn
 -error                       set message level to error

==== help options
 -?                           display this help
 -deprecated                  show deprecated options



    从1.3版本后系统属性被包含在ivy变量中,因此你可以很容易的定义ivy变量,类似这样:

    2) 例子

    java  - jar ivy.jar


     用默认配置和当前目录里面的ivy.xml调用ivy

java  - jar ivy.jar  - settings path / to / myivysettings.xml  - ivy path / to / myivy.xml


    用给定的ivysettings文件和给定的ivy文件调用ivy

    1. 从1.3版本开始

java  - jar ivy.jar  - settings path / to / myivysettings.xml  - dependency apache commons - lang  2.0


    用给定的ivysettings文件调用ivy并解析依赖apache commons-lang 2.0.

    这等同于:

java -jar ivy.jar -settings path/to/myivysettings.xml -ivy ivy.xml

   
    而ivy.xml内容如下:

< ivy-module  version ="1.0" >
  
< info  organisation ="org"
       module
="standalone"
       revision
="working"
   
/>
  
< dependencies >
    
< dependency  org ="apache"  name ="commons-lang"  rev ="2.0"  conf ="default->*" />
  
</ dependencies >
</ ivy-module >


    2. 从1.3版本开始

java  - jar ivy.jar  - settings path / to / myivysettings.xml  - ivy path / to / myivy.xml  - cachepath mycachefile.txt


    用给定的ivysettings文件调用ivy并解析在给定的ivy文件中发现的依赖,然后输出被解析的在缓存中的制品的classpath到文件中。这个文件随后可以被用来为任何java程序定义符合所有被解析的依赖的classpath。

    3. 从 1.4开始

java  - jar ivy.jar  - settings path / to / myivysettings.xml  - dependency bar foo  2.0   - main org.bar.foo.FooMain


用给定的ivysettings文件调用ivy并解析依赖bar foo 2.0,然后用解析出来的制品运行类org.foo.FooMain。

 

 

评论 共 0 条 请登录后发表评论

发表评论

您还没有登录,请您登录后再发表评论

文章信息

  • skydream在2009-09-02创建
  • skydream在2011-05-26更新
  • 标签: ivy, 中文参考文档, 单独使用
Global site tag (gtag.js) - Google Analytics