build.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?xml version = '1.0'?>
  2. <!DOCTYPE project [
  3. <!ENTITY buildProbs SYSTEM "./build.properties">
  4. <!ENTITY wscompile SYSTEM "./wscompile-config.xml">
  5. ]>
  6. <project basedir="." name="jplagTutorial" default="cnj-client">
  7. &buildProbs;
  8. <property name="compile.debug" value="true" />
  9. <path id="app.classpath">
  10. <fileset dir="${clientlibs}"/>
  11. </path>
  12. <path id="client.classpath">
  13. <path refid="app.classpath" />
  14. <pathelement location="${basedir}/classes"/>
  15. </path>
  16. <!-- Generate the JPlag stub -->
  17. <target name="prepare-client">
  18. <mkdir dir="${basedir}/classes" />
  19. <mkdir dir="${basedir}/connectclasses" />
  20. <mkdir dir="${basedir}/dist" />
  21. </target>
  22. <target name="prepare-wscompile" depends="prepare-client">
  23. <javac destdir="${basedir}/classes"
  24. includes="util/wscompileSSLLauncher.java" srcdir="${basedir}"
  25. debug="${compile.debug}">
  26. <classpath refid="app.classpath" />
  27. </javac>
  28. &wscompile;
  29. </target>
  30. <target name="compile-client-handler" depends="prepare-client">
  31. <javac destdir="${basedir}/classes"
  32. includes="util/JPlagClientAccessHandler.java"
  33. srcdir="${basedir}" debug="${compile.debug}">
  34. <classpath refid="client.classpath" />
  35. </javac>
  36. </target>
  37. <target name="generate-client" depends="compile-client-handler, prepare-wscompile">
  38. <wscompile base="${basedir}/classes" features="wsi"
  39. config="${basedir}/config-client.xml" xPrintStackTrace="true"
  40. keep="true" sourcebase="${basedir}/.."
  41. client="true" verbose="true">
  42. <classpath>
  43. <path refid="client.classpath" />
  44. </classpath>
  45. </wscompile>
  46. </target>
  47. <!-- Create the ExampleConnect application -->
  48. <target name="compile-exampleconnect" depends="prepare-client">
  49. <available file="${basedir}/jplagClient" type="dir" property="client-built"/>
  50. <fail unless="client-built">
  51. JPlag stub is not built yet!
  52. Please call 'generate-client' first!
  53. </fail>
  54. <javac destdir="${basedir}/connectclasses" srcdir="${basedir}"
  55. includes="ExampleConnect.java jplagClient/*.java"
  56. debug="${compile.debug}" deprecation="on">
  57. <classpath refid="client.classpath" />
  58. </javac>
  59. </target>
  60. <target name="jar-exampleconnect">
  61. <jar destfile="${basedir}/dist/exampleConnect.jar">
  62. <zipfileset dir="${basedir}/classes"
  63. includes="jplagTutorial/util/JPlagClientAccessHandler.class" />
  64. <zipfileset dir="${basedir}/connectclasses"
  65. excludes="jplagTutorial/util/*.class" />
  66. <zipfileset src="${clientlibs}/jaxrpc-api.jar" includes="**/*"
  67. excludes="META-INF/WEBSTART.*" />
  68. <zipfileset src="${clientlibs}/jaxrpc-impl.jar" includes="**/*"
  69. excludes="META-INF/WEBSTART.*" />
  70. <zipfileset src="${clientlibs}/jaxrpc-spi.jar" includes="**/*"
  71. excludes="META-INF/WEBSTART.*" />
  72. <zipfileset src="${clientlibs}/activation.jar" includes="**/*"
  73. excludes="META-INF/WEBSTART.*" />
  74. <zipfileset src="${clientlibs}/mail.jar" includes="**/*"
  75. excludes="META-INF/WEBSTART.*" />
  76. <zipfileset src="${clientlibs}/saaj-api.jar" includes="**/*"
  77. excludes="META-INF/WEBSTART.*" />
  78. <zipfileset src="${clientlibs}/saaj-impl.jar" includes="**/*"
  79. excludes="META-INF/WEBSTART.*" />
  80. <zipfileset src="${clientlibs}/jsr173_api.jar" includes="**/*"
  81. excludes="META-INF/WEBSTART.*" />
  82. <zipfileset src="${clientlibs}/sjsxp.jar" includes="**/*"
  83. excludes="META-INF/WEBSTART.*" />
  84. <zipfileset src="${clientlibs}/FastInfoset.jar" includes="**/*"
  85. excludes="META-INF/WEBSTART.*" />
  86. <manifest>
  87. <attribute name="Main-Class"
  88. value="jplagTutorial.ExampleConnect" />
  89. </manifest>
  90. </jar>
  91. </target>
  92. <target name="cnj-exampleconnect"
  93. depends="compile-exampleconnect, jar-exampleconnect"/>
  94. <!-- Create the ExampleClient application -->
  95. <target name="compile-client" depends="prepare-client">
  96. <available file="${basedir}/jplagClient" type="dir" property="client-built"/>
  97. <fail unless="client-built">
  98. JPlag stub is not built yet!
  99. Please call 'generate-client' first!
  100. </fail>
  101. <javac destdir="${basedir}/classes" srcdir="${basedir}"
  102. debug="${compile.debug}" deprecation="on">
  103. <classpath refid="client.classpath" />
  104. </javac>
  105. </target>
  106. <!--
  107. Generates a jar file including all needed libraries. As the resulting
  108. file is over 3 MB, this isn't very useful for an application which gets
  109. updated regularly, as this would require the whole file to be downloaded
  110. again, instead of only the real application.
  111. The advantage is, that you only need to supply one single file, which
  112. is fully functional (except for the JRE of course).
  113. Note: Use "java -jar dist/exampleClient.jar" to start the application.
  114. It will show you, which parameters are required.
  115. Note: The 'excludes="META-INF/WEBSTART.*"' is only needed, if the
  116. libraries have been signed, because, if these files exist in the
  117. final jar file, the program will abort with a SecurityException.
  118. -->
  119. <target name="jar-client">
  120. <jar destfile="${basedir}/dist/exampleClient.jar">
  121. <zipfileset dir="${basedir}/classes"
  122. excludes="jplagTutorial/util/wscompile*.class" />
  123. <zipfileset src="${clientlibs}/jaxrpc-api.jar" includes="**/*"
  124. excludes="META-INF/WEBSTART.*" />
  125. <zipfileset src="${clientlibs}/jaxrpc-impl.jar" includes="**/*"
  126. excludes="META-INF/WEBSTART.*" />
  127. <zipfileset src="${clientlibs}/jaxrpc-spi.jar" includes="**/*"
  128. excludes="META-INF/WEBSTART.*" />
  129. <zipfileset src="${clientlibs}/activation.jar" includes="**/*"
  130. excludes="META-INF/WEBSTART.*" />
  131. <zipfileset src="${clientlibs}/mail.jar" includes="**/*"
  132. excludes="META-INF/WEBSTART.*" />
  133. <zipfileset src="${clientlibs}/saaj-api.jar" includes="**/*"
  134. excludes="META-INF/WEBSTART.*" />
  135. <zipfileset src="${clientlibs}/saaj-impl.jar" includes="**/*"
  136. excludes="META-INF/WEBSTART.*" />
  137. <zipfileset src="${clientlibs}/jsr173_api.jar" includes="**/*"
  138. excludes="META-INF/WEBSTART.*" />
  139. <zipfileset src="${clientlibs}/sjsxp.jar" includes="**/*"
  140. excludes="META-INF/WEBSTART.*" />
  141. <zipfileset src="${clientlibs}/FastInfoset.jar" includes="**/*"
  142. excludes="META-INF/WEBSTART.*" />
  143. <manifest>
  144. <attribute name="Main-Class"
  145. value="jplagTutorial.ExampleClient" />
  146. </manifest>
  147. </jar>
  148. </target>
  149. <target name="cnj-client" depends="compile-client, jar-client"/>
  150. <!--
  151. If you want to use create a Web Start application with this, you'll have
  152. to sign your jar as well as the libraries you provide with the same key.
  153. The key may either be a correct key from a certification authority or a
  154. self-created key. You can create a self-created by invoking something like
  155. the following command on your shell prompt:
  156. keytool -genkey -keystore jplagClient -alias webstart
  157. This jar can also be used for a command line version, if you provide a
  158. bat file and a sh file to call the application with the correct classpath.
  159. Of course you'll also have to provide the libraries.
  160. -->
  161. <target name="jar-webstart" depends="compile-client">
  162. <jar destfile="${basedir}/dist/exampleClient.jar">
  163. <zipfileset dir="${basedir}/classes" excludes="util/*.class" />
  164. </jar>
  165. <signjar keystore="jplagClient.key" alias="webstart"
  166. storepass="your_keystore_password">
  167. <fileset dir="${basedir}/dist" includes="*.jar" />
  168. </signjar>
  169. </target>
  170. <!--
  171. Signs all libraries in the ${clientlibs} folder with the current
  172. jplagClient.key. These libraries can then be copied to the server
  173. to be used for a Web Start application
  174. -->
  175. <target name="signlibs">
  176. <signjar keystore="jplagClient.key" alias="webstart"
  177. storepass="your_keystore_password">
  178. <fileset dir="${clientlibs}" includes="*.jar" />
  179. </signjar>
  180. </target>
  181. <target name="run-client">
  182. <java fork="true" classpathref="client.classpath"
  183. classname="jplagTutorial.ExampleClient" />
  184. </target>
  185. <target name="cnr-client" depends="compile-client, run-client"/>
  186. <target name="clean">
  187. <delete dir="${basedir}/classes" />
  188. <delete dir="${basedir}/dist" />
  189. </target>
  190. </project>