【问题标题】:Ant change directory structure in the war fileAnt改变war文件中的目录结构
【发布时间】:2016-10-06 16:24:40
【问题描述】:

我是 ant 新手,我必须将我的 web 项目包装在 war 文件中,我正在使用 ant 我的项目结构如下:

我的项目
--图片
--css
--js

在war文件中最终的结构是这样的:

我的项目
--css
--图片
--js
--META-INF
--WEB-INF

我想更改最终结构(将项目目录中的所有内容放在“公共”文件夹中)但仅在 war 文件中,我希望是这样的:

我的项目
--公共
-----css
-----图片
-----js
--META-INF
--WEB-INF

我尝试使用复制任务和移动任务但没有成功... 我应该怎么做才能做到这一点?

【问题讨论】:

标签: ant war build.xml


【解决方案1】:

我认为在zipfileset 中使用prefix 属性可能会对您有所帮助(请参阅zipfileset):

<target name="Wrappin the in war file" description="Compiling....">
    <mkdir dir="${build-directory}" />
    <delete file="${build-directory}/${war-file-name}" />
    <war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
        <zipfileset dir="${web-directory}" prefix="public">
            <exclude name=".git/**" />
            <exclude name=".svn/**" />
            <exclude name=".idea/**" />
            <exclude name="node_modules/**" />
            <exclude name="bower_components/**" />
        </zipfileset>
        <manifest>
            <attribute name="Built-By" value="${builder}" />
            <attribute name="Built-On" value="${build-info.current-date}" />
            <attribute name="Built-At" value="${build-info.current-time}" />
        </manifest>
    </war>
</target>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-26
    • 1970-01-01
    • 2011-06-19
    相关资源
    最近更新 更多