蚂蚁没有创造tar文件 [英] Ant not creating tar files

查看:275
本文介绍了蚂蚁没有创造tar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有应该创建3 tar文件有点ant脚本。

I have a little ant script which should create 3 tar files.

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="."  >

    <property name="dcc-shell.dir" value="${basedir}"/>
    <property name="dcc-mdp.dir" value="${dcc-shell.dir}/eq-mo-drop-copy-converter-mdp"/>
    <property name="mdp-code.dir" value="${dcc-mdp.dir}/src/main/*"/>
    <property name="dcc-srv.dir" value="${dcc-shell.dir}/eq-mo-drop-copy-converter-server"/>
    <property name="srv-code.dir" value="${dcc-srv.dir}/src/main/*"/>
    <property name="dcc-trans.dir" value="${dcc-shell.dir}/eq-mo-drop-copy-converter-transformer"/>
    <property name="trans-code.dir" value="${dcc-trans.dir}/src/main/*"/>

    <target name="create MDP Tar">
        <tar destfile="${dcc-shell.dir}/mdp.tar"
            basedir="${dcc-mdp.dir}/**"
            excludes="${dcc-mdp.dir}/target/*"
        />
    </target>

    <target name="create Trans Tar">
        <tar destfile="${dcc-shell.dir}/trans.tar"
            basedir="${dcc-trans.dir}/**"
            excludes="${dcc-trans.dir}/target/*"
        />
    </target>

    <target name="create SRV Tar">
        <tar destfile="${dcc-shell.dir}/srv.tar"
            basedir="${dcc-srv.dir}/**"
            excludes="${dcc-srv.dir}/target/*"
        />
    </target>
</project>

该脚本运行良好:

The script runs fine:

    Buildfile: C:\eq-Drop-Copy\eq-mo-drop-copy-converter-shell\build.xml
BUILD SUCCESSFUL
Total time: 94 milliseconds

但无焦油文件在项目中创建。有点神秘,以自己的

However no tar files are created within the project. Somewhat of a mystery to myself

修改
我一直收到以下错误!

EDIT I have been getting the following error!

    <target name="create MDP.Tar">
    <tar destfile="C:/eq-Drop-Copy/eq-mo-drop-copy-converter-shell/mdp.tar"
        basedir="C:/eq-Drop-Copy/eq-mo-drop-copy-converter-shell/eq-mo-drop-copy-converter-mdp/*"
        excludes="C:/eq-Drop-Copy/eq-mo-drop-copy-converter-shell/eq-mo-drop-copy-converter-mdp/target/*"
    />
</target>

我已经改变了XML的absoulet路径:

I have changed the xml to the absoulet paths:

    <target name="create MDP.Tar">
    <tar destfile="C:/eq-Drop-Copy/eq-mo-drop-copy-converter-shell/mdp.tar"
        basedir="C:/eq-Drop-Copy/eq-mo-drop-copy-converter-shell/eq-mo-drop-copy-converter-mdp/*"
        excludes="C:/eq-Drop-Copy/eq-mo-drop-copy-converter-shell/eq-mo-drop-copy-converter-mdp/target/*"
    />
</target>

不过还是同样的错误怎么能BASEDIR不存在生成文件包含在其中。在MDP目标中的BASEDIR指向一个路径absoulet和焦油中的所有文件。为什么会变成这样给人一种错误?

However still the same error how can the basedir not exist the build file is contained within it. The basedir within the MDP target is pointing to an absoulet path and tar all the files within that. why would this be giving an error?

推荐答案

我纠正几个问题:


  • BASEDIR 属性不应该有*在里面。它会自动完成整个树。

  • 目标不能包含空格

  • 您可能没有指定目标。所以,我只是增加了一个默认目标create_all_tars,并用&LT; antcall&GT; 来调用所需的目标。

  • basedir attribute shouldn't have "*" in it. It'll automatically do the whole tree.
  • Targets can't contain spaces
  • You probably didn't specify targets. Therefore, I simply added a default target "create_all_tars", and used <antcall> to call the needed targets.

<project basedir="." default="create_all_tars" >
    <property name="dcc-shell.dir"
        value="${basedir}"/>
    <property name="dcc-mdp.dir"
        value="${dcc-shell.dir}/eq-mo-drop-copy-converter-mdp"/>
    <property name="mdp-code.dir"
        value="${dcc-mdp.dir}/src/main/*"/>
    <property name="dcc-srv.dir"
        value="${dcc-shell.dir}/eq-mo-drop-copy-converter-server"/>
    <property name="srv-code.dir"
        value="${dcc-srv.dir}/src/main/*"/>
     <property name="dcc-trans.dir"
         value="${dcc-shell.dir}/eq-mo-drop-copy-converter-transformer"/>
     <property name="trans-code.dir"
         value="${dcc-trans.dir}/src/main/*"/>

    <target name="create_all_tars">
        <antcall target="create_MDP_Tar"/>
        <antcall target="create_Trans_Tar"/>
        <antcall target="create_SRV_tar"/>
    </target>

    <target name="create_MDP_Tar">
        <tar destfile="${dcc-shell.dir}/mdp.tar"
            basedir="${dcc-mdp.dir}"
            excludes="${dcc-mdp.dir}/target/**"/>
    </target>

    <target name="create_Trans_Tar">
        <tar destfile="${dcc-shell.dir}/trans.tar"
            basedir="${dcc-trans.dir}"
            excludes="${dcc-trans.dir}/target/**"/>
    </target>

    <target name="create_SRV_Tar">
        <tar destfile="${dcc-shell.dir}/srv.tar"
            basedir="${dcc-srv.dir}"
            excludes="${dcc-srv.dir}/target/**"/>
    </target>

这是否帮助?

这篇关于蚂蚁没有创造tar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆