build.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="ebidBuild" default="default" basedir=".">
  3. <property file="build.properties" />
  4. <target name="default">
  5. <echo message="selete target." />
  6. <echo message="profile active ${profiles.active}" />
  7. <echo message="java version ${java.version}" />
  8. <echo message="ant java version ${ant.java.version}" />
  9. <echo message="ant version ${ant.version}" />
  10. <echo message="oracle home ${oracle.home}" />
  11. </target>
  12. <target name="datetime" description="create current date" depends="default">
  13. <tstamp prefix="build-info">
  14. <format property="current-date" pattern="yyyy-MM-dd" />
  15. <format property="current-time" pattern="HH:mm:ss" />
  16. </tstamp>
  17. <echo message="Build started at : ${build-info.current-date} ${build-info.current-time}" />
  18. </target>
  19. <property name="build-directory" value="build"/>
  20. <property name="source-directory" value="java"/>
  21. <property name="web-directory" value="web"/>
  22. <property name="web-inf-directory" value="${build-directory}/${web-directory}/WEB-INF"/>
  23. <property name="lib-directory" value="${web-inf-directory}/lib"/>
  24. <property name="classes-directory" value="${web-inf-directory}/classes"/>
  25. <property name="class-path" value="WEB-INF/classes"/>
  26. <property name="war-file-name" value="ebidApp"/>
  27. <property name="war-portal-file-name" value="ebidPortalApp"/>
  28. <property name="weblogic.jar.file" value="${oracle.home}/wlserver_10.3/server/lib/weblogic.jar"/>
  29. <path id="classpath">
  30. <fileset file="${weblogic.jar.file}" />
  31. <fileset dir="${lib-directory}" includes="*.jar" />
  32. <fileset dir="${oracle.home}/modules" includes="*.jar" />
  33. </path>
  34. <target name="clean">
  35. <delete dir="${build-directory}" />
  36. <mkdir dir="${build-directory}" />
  37. </target>
  38. <target name="copy-non-java-files" depends="clean">
  39. <!-- web폴더의 모든 파일을 build폴더로 복사 'WEB-INF/classes'폴더 제외 -->
  40. <copy todir="${build-directory}/${web-directory}" includeemptydirs="false">
  41. <fileset dir="${web-directory}">
  42. <exclude name="${class-path}/" />
  43. </fileset>
  44. </copy>
  45. <!-- 소스폴더의 *.java 파일을 제외한 나머지 파일을 'WEB-INF/classes'폴더로 복사 -->
  46. <copy todir="${classes-directory}" includeemptydirs="false">
  47. <fileset dir="${source-directory}" excludes="**/*.java" />
  48. </copy>
  49. <!-- waf 설정을 build 파일에 포함 -->
  50. <!--copy todir="${build-directory}/${web-directory}/resources" includeemptydirs="false">
  51. <fileset dir="resources/${profiles.active}" />
  52. </copy-->
  53. </target>
  54. <!-- webPortal 설정 -->
  55. <target name="web-portal-files" depends="copy-non-java-files">
  56. <copy file="webPortal/jsp/ko_KR/index.jsp" tofile="${build-directory}/${web-directory}/jsp/ko_KR/index.jsp" overwrite="true" />
  57. </target>
  58. <target name="compile">
  59. <javac debug="yes" debuglevel="lines,vars,source" includeantruntime="false"
  60. destdir="${classes-directory}" source="1.6" target="1.6"
  61. encoding="UTF8">
  62. <src path="${source-directory}" />
  63. <classpath refid="classpath" />
  64. </javac>
  65. <!--jar jarfile="${lib-directory}/ebid.jar" basedir="${classes-directory}" />
  66. <delete dir="${classes-directory}" /-->
  67. </target>
  68. <target name="compile_web" depends="copy-non-java-files,compile" />
  69. <target name="compile_web_portal" depends="web-portal-files,compile" />
  70. <target name="war_web" depends="datetime,compile_web">
  71. <war warfile="${build-directory}/${war-file-name}.war" webxml="${web-inf-directory}/web.xml">
  72. <fileset dir="${build-directory}/${web-directory}" />
  73. <manifest>
  74. <attribute name="Built-On" value="${build-info.current-date}"/>
  75. <attribute name="Built-At" value="${build-info.current-time}"/>
  76. </manifest>
  77. </war>
  78. </target>
  79. <target name="war_web_portal" depends="datetime,compile_web_portal">
  80. <war warfile="${build-directory}/${war-portal-file-name}.war" webxml="${web-inf-directory}/web.xml">
  81. <fileset dir="${build-directory}/${web-directory}" />
  82. <manifest>
  83. <attribute name="Built-On" value="${build-info.current-date}"/>
  84. <attribute name="Built-At" value="${build-info.current-time}"/>
  85. </manifest>
  86. </war>
  87. </target>
  88. <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" classpath="${weblogic.jar.file}"/>
  89. <taskdef name="wlserver" classname="weblogic.ant.taskdefs.management.WLServer" classpath="${weblogic.jar.file}"/>
  90. <target name="undeploy">
  91. <wldeploy
  92. action="undeploy" verbose="true" debug="true"
  93. adminurl="${weblogic.deploy.url.admin}" targets="${weblogic.deploy.target}"
  94. user="${weblogic.deploy.user}" password="${weblogic.deploy.password}"
  95. name="${weblogic.deploy.name}" failonerror="false" usenonexclusivelock="true" />
  96. </target>
  97. <target name="deploy" depends="undeploy">
  98. <sleep seconds="10" />
  99. <wldeploy
  100. action="deploy" verbose="true" debug="true" remote="true" upload="true"
  101. user="${weblogic.deploy.user}" password="${weblogic.deploy.password}"
  102. adminurl="${weblogic.deploy.url.admin}" targets="${weblogic.deploy.target}"
  103. name="${weblogic.deploy.name}" source="${build-directory}/${war-file-name}.war"
  104. nostage="true" usenonexclusivelock="true" />
  105. <sleep seconds="10" />
  106. <wldeploy
  107. action="start" verbose="true" debug="true"
  108. user="${weblogic.deploy.user}" password="${weblogic.deploy.password}"
  109. adminurl="${weblogic.deploy.url.admin}" targets="${weblogic.deploy.target}"
  110. name="${weblogic.deploy.name}" />
  111. </target>
  112. <target name="undeploy_portal">
  113. <wldeploy
  114. action="undeploy" verbose="true" debug="true"
  115. adminurl="${weblogic.deploy.url.admin}" targets="${weblogic.deploy.portal.target}"
  116. user="${weblogic.deploy.user}" password="${weblogic.deploy.password}"
  117. name="${weblogic.deploy.portal.name}" failonerror="false" usenonexclusivelock="true" />
  118. </target>
  119. <target name="deploy_portal" depends="undeploy_portal">
  120. <sleep seconds="10" />
  121. <wldeploy
  122. action="deploy" verbose="true" debug="true" remote="true" upload="true"
  123. user="${weblogic.deploy.user}" password="${weblogic.deploy.password}"
  124. adminurl="${weblogic.deploy.url.admin}" targets="${weblogic.deploy.portal.target}"
  125. name="${weblogic.deploy.portal.name}" source="${build-directory}/${war-portal-file-name}.war"
  126. nostage="true" usenonexclusivelock="true" />
  127. <sleep seconds="10" />
  128. <wldeploy
  129. action="start" verbose="true" debug="true"
  130. user="${weblogic.deploy.user}" password="${weblogic.deploy.password}"
  131. adminurl="${weblogic.deploy.url.admin}" targets="${weblogic.deploy.portal.target}"
  132. name="${weblogic.deploy.portal.name}" />
  133. </target>
  134. <!-- 전자조달 시스템 빌드,배포 -->
  135. <target name="start" depends="war_web,deploy" />
  136. <target name="startNonWar" depends="compile_web,deploy" />
  137. <!-- 전자조달 시스템 협력사 빌드,배포 -->
  138. <target name="startPortal" depends="war_web_portal,deploy_portal" />
  139. <target name="startPortalNonWar" depends="compile_web_portal,deploy_portal" />
  140. </project>