复制任务出现问题

发布于 2024-11-19 06:56:00 字数 2970 浏览 5 评论 0原文

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

我有 2 个像这样的 ant 目标,

<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 文件复制到外部文件夹时,它们会损坏。

When I war a spring mvc project, the war file cannot be deployed to tomcat with ZipException oversubscribed literal/length tree. I find that when I open All files in WEB-INF/LIB/*.jar when I try to open them using winrar I got "unexpected archive file"

I've 2 ant targets that's like this

<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>

I found now the problem in the copy target, when it copies the *.jar files to an external folder they become corrupted.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独自←快乐 2024-11-26 06:56:00

我发现了问题。

        <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>

I found the problem.

        <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>

should be

        <copy todir="${web.dir}/WEB-INF/">
            <fileset dir="src/main/webapp/WEB-INF/">
                <include name="**/*.*" />
            </fileset>
        </copy>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文