0

当我对 spring mvc 项目进行战争时,无法将战争文件部署到 ZipException 超额订阅文字/长度树的 tomcat。我发现当我尝试使用 winrar 打开 WEB-INF/LIB/*.jar 中的所有文件时,我得到“意外的存档文件”

我有 2 个像这样的蚂蚁目标

<target name="build" description="Compile main source tree java files">
        <mkdir dir="${build.dir}" />
        <copy todir="${web.dir}/WEB-INF/">
            <fileset dir="src/main/webapp/WEB-INF/">
                <include name="**/*.*" />
            </fileset>
            <filterchain>
                <striplinecomments>
                    <comment value="!" />
                </striplinecomments>
                <replacetokens>
                    <token key="hibernate.connection.url" value="${hibernate.connection.url}" />
                    <token key="hibernate.connection.username" value="${hibernate.connection.username}" />
                    <token key="hibernate.connection.password" value="${hibernate.connection.password}" />
                    <token key="fontFamily" value="arial, helvetica, sans-serif" />
                </replacetokens>
            </filterchain>
        </copy>
        <copy todir="${build.dir}">
            <fileset dir="src/main/resources">
                <include name="**/*.*" />
            </fileset>
            <filterchain>
                <striplinecomments>
                    <comment value="!" />
                </striplinecomments>
                <replacetokens>
                    <token key="hibernate.connection.url" value="${hibernate.connection.url}" />
                    <token key="hibernate.connection.username" value="${hibernate.connection.username}" />
                    <token key="hibernate.connection.password" value="${hibernate.connection.password}" />
                    <token key="fontFamily" value="arial, helvetica, sans-serif" />
                </replacetokens>
            </filterchain>
        </copy>

        <javac destdir="${build.dir}" source="1.6" target="1.6" debug="true" deprecation="false" optimize="false" failonerror="true">
            <src path="${src.dir}" />
            <classpath refid="master-classpath" />
        </javac>
    </target>

    <target name="deploywar" depends="build" description="Deploy application as a WAR file">
        <war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
            <fileset dir="${web.dir}">
                <include name="**/*.*" />
            </fileset>
        </war>
        <copy todir="${deploy.path}" preservelastmodified="true">
            <fileset dir=".">
                <include name="*.war" />
            </fileset>
        </copy>

我现在在复制目标中发现了问题,当它将 *.jar 文件复制到外部文件夹时,它们已损坏。

4

1 回答 1

0

我发现了问题。

        <copy todir="${web.dir}/WEB-INF/">
            <fileset dir="src/main/webapp/WEB-INF/">
                <include name="**/*.*" />
            </fileset>
            <filterchain>
                <striplinecomments>
                    <comment value="!" />
                </striplinecomments>
                <replacetokens>
                    <token key="hibernate.connection.url" value="${hibernate.connection.url}" />
                    <token key="hibernate.connection.username" value="${hibernate.connection.username}" />
                    <token key="hibernate.connection.password" value="${hibernate.connection.password}" />
                    <token key="fontFamily" value="arial, helvetica, sans-serif" />
                </replacetokens>
            </filterchain>
        </copy>

应该

        <copy todir="${web.dir}/WEB-INF/">
            <fileset dir="src/main/webapp/WEB-INF/">
                <include name="**/*.*" />
            </fileset>
        </copy>
于 2011-07-10T11:31:43.370 回答