打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ivy安装
IVY,它是一个管理(记录、跟踪、解析和报告)项目依赖的工具,可与ApacheAnt紧密集成,很多的信息,请参照:
http://ant.apache.org/ivy 

1.代码可以从这里得到 svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy 
2.确保你的机子上已经安装了ant (version 1.6.5 or 以上)与jdk1.5,进入$IVY_HOME(checkout svn url的目录)后,运行ant jar ,在$IVY_HOME/build会生成一些jar包,把$IVY_HOME/build/artifact/ivy.jar 和$IVY_HOME/lib/jsch.jar 拷贝到$ANT_HOME/lib(如果是windows %ANT_HOME%/lib) 
3.这样就可以在build.xml用 ivy dependency 

e.g: 
这是个是build.xml 
<project name="hello-ivy" default="run" xmlns:ivy="antlib:org.apache.ivy.ant"> 
    <!--引入ivy dependency --> 
    <!-- some variables used --> 
    <property name="lib.dir" value="lib" /> 
    <property name="build.dir" value="build" /> 
    <property name="src.dir" value="src" /> 
    
    <!-- paths used for compilation and run  --> 
    <path id="lib.path.id"> 
        <fileset dir="${lib.dir}" /> 
</path> 
    <path id="run.path.id"> 
        <path refid="lib.path.id" /> 
        <path location="${build.dir}" /> 
    </path> 
    
    <!-- ================================= 
          target: resolve   得到所依赖的文件,依赖的文件在ivy.xml下设置          
         ================================= --> 
    <target name="resolve" description="--> retreive dependencies with ivy"> 
        <ivy:retrieve/> 
    </target> 
    
    <!-- ================================= 
          target: report    导入一些report 信息          
         ================================= --> 
    <target name="report" depends="resolve" description="--> generates a report of dependencies"> 
        <ivy:report todir="${build.dir}"/> 
    </target> 
    
    <!-- ================================= 
          target: run 
         ================================= --> 
    <target name="run" depends="resolve" description="--> compile and run the project"> 
        <mkdir dir="${build.dir}" /> 
        <javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" /> 
    <property name="msg" value="hello ivy !"/> 
        <java classpathref="run.path.id" classname="example.Hello"> 
        <arg value="-message"/> 
        <arg value="${msg}"/> 
    </java> 
    </target> 

    <!-- ================================= 
          target: clean              
         ================================= --> 
    <target name="clean" description="--> clean the project"> 
        <delete includeemptydirs="true"> 
            <fileset dir="${basedir}"> 
            <exclude name="src/**" /> 
            <exclude name="build.xml" /> 
              <exclude name="ivy.xml" /> 
        </fileset> 
    </delete> 
    </target> 

    <!-- ================================= 
          target: clean-cache   删除所有依赖的缓存文件           
         ================================= --> 
<target name="clean-cache" description="--> clean the ivy cache"> 
<ivy:cleancache /> 
</target> 
</project> 

这个是ivy.xml 

<ivy-module version="1.0"> 
    <info organisation="apache" module="ivyrep-example"/> 
    <dependencies> 
        <dependency org="apache" name="commons-lang" rev="2.0"/> 
        <dependency org="apache" name="commons-cli" rev="1.0"/> 
    </dependencies> 
</ivy-module> 
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
eclipseEE版本中使用ivy管理jar包
Apache Ant使用进阶
cruisecontrol、ant、svn持续集成
基于CentOS 6.2的eclipse
Hadoop2.x eclipse plugin插件编译安装配置【转】
Hadoop2.4.0 Eclipse插件制作
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服