Skip to content

Commit f051e6e

Browse files
author
Zahrun
committed
Server init project
1 parent 4ca222f commit f051e6e

32 files changed

+4279
-1
lines changed

.gitignore

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
/Server/RESTDemo/nbproject/private/
22
/Server/EnterpriseApplication1/nbproject/private/
33
/Server/JavaApplication1/nbproject/private/
4-
/Server/RESTDemo/rest-sample-module/nbproject/private/
4+
/Server/RESTDemo/rest-sample-module/nbproject/private/
5+
/Server/nbproject/private/
6+
/Server/Server-war/nbproject/private/
7+
/Server/Server-ejb/build/
8+
/Server/build/
9+
/Server/dist/
10+
/Server/Server-war/dist/
11+
/Server/Server-war/build/
12+
/Server/Server-ejb/dist/

Server/Server-ejb/build.xml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- You may freely edit this file. See commented blocks below for -->
3+
<!-- some examples of how to customize the build. -->
4+
<!-- (If you delete it and reopen the project it will be recreated.) -->
5+
<!-- By default, only the Clean and Build commands use this build script. -->
6+
<!-- Commands such as Run, Debug, and Test only use this build script if -->
7+
<!-- the Compile on Save feature is turned off for the project. -->
8+
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9+
<!-- in the project's Project Properties dialog box.-->
10+
<project name="Server-ejb" default="default" basedir="." xmlns:ejbjarproject="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
11+
<description>Builds, tests, and runs the project Server-ejb.</description>
12+
<import file="nbproject/build-impl.xml"/>
13+
<!--
14+
15+
There exist several targets which are by default empty and which can be
16+
used for execution of your tasks. These targets are usually executed
17+
before and after some main targets. They are:
18+
19+
-pre-init: called before initialization of project properties
20+
-post-init: called after initialization of project properties
21+
-pre-compile: called before javac compilation
22+
-post-compile: called after javac compilation
23+
-pre-compile-single: called before javac compilation of single file
24+
-post-compile-single: called after javac compilation of single file
25+
-pre-dist: called before archive building
26+
-post-dist: called after archive building
27+
-post-clean: called after cleaning build products
28+
-pre-run-deploy: called before deploying
29+
-post-run-deploy: called after deploying
30+
31+
(Targets beginning with '-' are not intended to be called on their own.)
32+
33+
Example of pluging an obfuscator after the compilation could look like
34+
35+
<target name="-post-compile">
36+
<obfuscate>
37+
<fileset dir="${build.classes.dir}"/>
38+
</obfuscate>
39+
</target>
40+
41+
For list of available properties check the imported
42+
nbproject/build-impl.xml file.
43+
44+
45+
Other way how to customize the build is by overriding existing main targets.
46+
The target of interest are:
47+
48+
init-macrodef-javac: defines macro for javac compilation
49+
init-macrodef-debug: defines macro for class debugging
50+
do-dist: archive building
51+
run: execution of project
52+
javadoc-build: javadoc generation
53+
54+
Example of overriding the target for project execution could look like
55+
56+
<target name="run" depends="<PROJNAME>-impl.jar">
57+
<exec dir="bin" executable="launcher.exe">
58+
<arg file="${dist.jar}"/>
59+
</exec>
60+
</target>
61+
62+
Notice that overridden target depends on jar target and not only on
63+
compile target as regular run target does. Again, for list of available
64+
properties which you can use check the target you are overriding in
65+
nbproject/build-impl.xml file.
66+
67+
-->
68+
</project>
+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project default="-deploy-ant" basedir=".">
3+
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
4+
<property file="${deploy.ant.properties.file}" />
5+
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
6+
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
7+
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
8+
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
9+
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
10+
</target>
11+
12+
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
13+
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
14+
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
15+
<!-- The doctype triggers resolution which can fail -->
16+
<replace file="${temp.sun.web}">
17+
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
18+
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
19+
</replace>
20+
<replace file="${temp.sun.web}">
21+
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
22+
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
23+
</replace>
24+
<xmlproperty file="${temp.sun.web}" validate="false">
25+
</xmlproperty>
26+
<delete file="${temp.sun.web}"/>
27+
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
28+
<isset property="sun-web-app.context-root"/>
29+
</condition>
30+
<condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
31+
<isset property="sun-web-app.context-root"/>
32+
</condition>
33+
</target>
34+
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
35+
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
36+
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
37+
<!-- The doctype triggers resolution which can fail -->
38+
<replace file="${temp.gf.web}">
39+
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
40+
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
41+
</replace>
42+
<replace file="${temp.gf.web}">
43+
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
44+
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
45+
</replace>
46+
<xmlproperty file="${temp.gf.web}" validate="false">
47+
</xmlproperty>
48+
<delete file="${temp.gf.web}"/>
49+
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
50+
<isset property="glassfish-web-app.context-root"/>
51+
</condition>
52+
<condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
53+
<isset property="glassfish-web-app.context-root"/>
54+
</condition>
55+
</target>
56+
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
57+
<property name="deploy.context.root.argument" value=""/>
58+
</target>
59+
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
60+
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
61+
<mkdir dir="${gfv3.resources.dir}"/>
62+
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
63+
<copy todir="${gfv3.resources.dir}/META-INF">
64+
<fileset dir="${deploy.ant.resource.dir}"/>
65+
</copy>
66+
<jar destfile="${deploy.ant.archive}" update="true">
67+
<fileset dir="${gfv3.resources.dir}"/>
68+
</jar>
69+
<delete dir="${gfv3.resources.dir}"/>
70+
</target>
71+
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
72+
<antcall target="-deploy-without-pw"/>
73+
<antcall target="-deploy-with-pw"/>
74+
</target>
75+
76+
<target name="-deploy-without-pw" unless="gfv3.password">
77+
<echo message="Deploying ${deploy.ant.archive}"/>
78+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
79+
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
80+
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
81+
dest="${gfv3.results.file}"/>
82+
<delete file="${gfv3.results.file}"/>
83+
</target>
84+
<target name="-deploy-with-pw" if="gfv3.password">
85+
<echo message="Deploying ${deploy.ant.archive}"/>
86+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
87+
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
88+
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
89+
dest="${gfv3.results.file}"/>
90+
<delete file="${gfv3.results.file}"/>
91+
</target>
92+
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
93+
<antcall target="-undeploy-without-pw"/>
94+
<antcall target="-undeploy-with-pw"/>
95+
</target>
96+
97+
<target name="-undeploy-without-pw" unless="gfv3.password">
98+
<echo message="Undeploying ${deploy.ant.archive}"/>
99+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
100+
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
101+
dest="${gfv3.results.file}"/>
102+
<delete file="${gfv3.results.file}"/>
103+
</target>
104+
<target name="-undeploy-with-pw" if="gfv3.password">
105+
<echo message="Undeploying ${deploy.ant.archive}"/>
106+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
107+
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
108+
dest="${gfv3.results.file}"/>
109+
<delete file="${gfv3.results.file}"/>
110+
</target>
111+
</project>

0 commit comments

Comments
 (0)