首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> Java 程式設計 >> Java 相關知識

Ivy 參考文檔:獨立使用指南

     編輯:Java 相關知識

獨立使用 Ivy

Ivy 可以非常容易地作為獨立程式使用,只需要 Java 1.4+ 執行環境 (JRE)!

命令列說明

執行 java -jar ivy.jar -? 可獲得線上說明:

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

==== resolve options
 -ivy              use given file as ivy file
 -dependency     use this instead of ivy file
 -confs     resolve given configurations

==== retrieve options
 -retrieve  use given pattern as retrieve pattern
 -sync                      use sync mode for retrieve

==== cache path options
 -cachepath  outputs classpath of all dependencies in cache

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

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

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

==== launcher options
 -main 
the FQCN of the main class to launch -args arguments to give to the launched process -cp extra classpath 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 變數。

使用範例

1. 基本用法

java -jar ivy.jar

用預設配置和當前目錄的 ivy.xml 調用 Ivy

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

用給定的 ivysettings 和 ivy 檔案調用 Ivy

2. 解析單一依賴(1.3 起)

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

等同於使用以下 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>

3. 輸出快取路徑(1.3 起)

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

解析依賴並輸出快取中制品的 classpath 到檔案,可用於任何 Java 程式。

4. 解析依賴並執行主類別(1.4 起)

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

解析依賴後用解析出的制品執行指定主類別。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved