How to get Ant to copy properties file to classes directory

随声附和 提交于 2019-12-07 11:45:18

问题


I have a project which I can build and deploy correctly using Ant

I want to build a war file to deploy the project.

I can get everything working except I cannot get the properties file to appear in the classes directory.

My properties file is located here: ${resources_dir}/${app}/Report.properties

This is the war section of my build file:

<war destfile="${dist_dir}/${app}.war" webxml="${resources_dir}/${app}/web.xml">    
     <fileset dir="${resources_dir}/${app}" includes="*.jsp,*.jspf,*.html,*.css" />
     <zipfileset dir="${resources_dir}/${app}/webct" prefix="webct" />
     <zipfileset dir="${resources_dir}/${app}/css" prefix="css" />
     <zipfileset dir="${resources_dir}/${app}/js" prefix="js" />    
     <zipfileset dir="${resources_dir}/${app}/images" prefix="images" />
     <classes dir="${build_dir}" includes="com/mycompany/${app}/*,com/mycompany/${app}/tixdata/*" />
     <lib dir="${commonlib_dir}">
          <include name="common.jar"/>
     </lib>
</war> 

How can I move the properties file into the correct classes directory?


回答1:


Just specify an additional classes element

<war destfile="${dist_dir}/${app}.war" webxml="${resources_dir}/${app}/web.xml"> 
     ..   
     <classes dir="${resources_dir}/${app}" includes="Report.properties"/>
     ..
</war> 

It's just a special form of fileset.



来源:https://stackoverflow.com/questions/3731085/how-to-get-ant-to-copy-properties-file-to-classes-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!