开发者社区> 问答> 正文

利用Ant打war包在Websphere上运行出错? 400 报错

利用Ant打war包在Websphere上运行出错? 400 报错

现有一个web应用,用eclipse打war包,部署到Websphere上没用问题,正常运行;

用ant打一个war包,在tomcat里运行没有问题,在Webshpere上运行就出现无法解释Struts2标签的问题

Error reading included file template/custom/controlheader.ftl

build文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="antwar" name="tm2">
 <target name="init" description="init">
  <property name="name" value="attachdemo"></property>
  <property name="packages" value="ant.*"></property>
  <property name="build.classes" value="${basedir}/WEB-INF/classes"/>
  <path id="classpath">
   <fileset dir="${basedir}/WEB-INF/lib">
    <include name="**/*.jar"/>
   </fileset>
 
   <fileset dir="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib">
    <include name="**/*.jar"/>
   </fileset>
  </path>
 </target>
 
 
 <patternset id="compiler.resources">
   <include name="**/?*.properties"/>
   <include name="**/?*.script"/>
   <include name="**/?*.xml"/>
   <include name="**/?*.html"/>
   <include name="**/?*.dtd"/>
   <include name="**/?*.tld"/>
   <include name="**/?*.gif"/>
   <include name="**/?*.png"/>
   <include name="**/?*.jpeg"/>
   <include name="**/?*.jpg"/>
   <include name="**/?*.sql"/>
 </patternset>
 
 
 

 <target name="prepare" depends="init" description="copy file">
   <delete dir="${build.classes}/com"/>
 </target>
 
 
 <target name="compile" depends="prepare" description="complie classes and copy file">
      <javac destdir="${build.classes}" encoding="utf-8" 
       classpat includeantruntime="false" 
        source="1.6" fork="true" memoryMaximumSize="512m">  
         <src path="${basedir}/src"/>
        </javac>  
  <copy todir="${build.classes}">
   <fileset dir="${basedir}/src">
    <patternset refid="compiler.resources"/>
    <!--<exclude name="**/com/documentum/**"/> -->
   </fileset>
  </copy>
 </target>
 
 <target name="antwar" depends="compile" description="begin build war">
   <war warfile="${basedir}/AntBuild/tm2.war">
    <fileset dir="${basedir}">
     <exclude name="**/AntBuild/**"/>
     <exclude name="**/doc/**"/>
     <exclude name="**/src/**"/>
     <exclude name="**/work/**"/>
    </fileset>
   </war>
 </target>
</project>

另外war包的大小也有差异,问题出现在哪里呢?为实现持续构建,项目最好用ant打war包

展开
收起
爱吃鱼的程序员 2020-06-04 11:53:20 467 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    跟编译没关系了,看:

    Error reading included file template/custom/controlheader.ftl

    检查一下应用中是不是有路径处理方式的问题,Tomcat 和 WebSphere 在处理一些 ContextPath 会有所不同的

    2020-06-04 16:46:23
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载