Wiki source code of Building and Installing a Framework with Ant
Last modified by Pascal Robert on 2013/12/18 02:55
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
31.1 | 1 | {{tip title="Pro Tip"}} |
2 | If you use Hudson/Jenkins to build your WebObjects Frameworks and Applications, then you do not need to build or install either the Project Wonder frameworks or even your own Frameworks on your development machine, just having yours and the individual Wonder source code projects (ERJars, ERExtensions, AJAX, etc) open in your eclipse workspace is sufficient. | ||
3 | {{/tip}} | ||
4 | |||
5 | |||
![]() |
47.1 | 6 | |
7 | {{toc maxLevel="3"/}} | ||
8 | |||
![]() |
37.1 | 9 | = Before You Build = |
![]() |
27.1 | 10 | |
![]() |
47.1 | 11 | When building a Framework project, Ant needs to be able to find WebObjects. WebObjects itself is a set of Frameworks just like the one you are building. They can be installed anywhere using [[these instructions>>doc:WO.Installing WebObjects 5\.4 on Snow Leopard]]. |
![]() |
27.1 | 12 | |
![]() |
47.1 | 13 | Where Ant will look for WebObjects is specified by the {{code language="none"}}wo.system.frameworks{{/code}} build property. This property can be set in a number of locations, or even passed as a command-line property to Ant. |
![]() |
27.1 | 14 | |
![]() |
37.1 | 15 | Where Ant looks for this property is different for each method of building a Framework: |
16 | |||
![]() |
47.1 | 17 | 1. ((( |
18 | ====== WOJenkins Jobs ====== | ||
![]() |
37.1 | 19 | |
![]() |
47.1 | 20 | 1. Completely managed for you by WOJenkins |
21 | 1. Manually overridden as defined in Manual Jenkins Jobs below. | ||
22 | ))) | ||
23 | 1. ((( | ||
24 | ====== Manual Jenkins Jobs ====== | ||
![]() |
37.1 | 25 | |
![]() |
47.1 | 26 | 1. Properties specified in the //Targets// line of an Invoke Ant build task using |
27 | |||
28 | {{code language="none"}} | ||
29 | -D<property>=<value> | ||
30 | {{/code}} | ||
![]() |
49.1 | 31 | |
![]() |
47.1 | 32 | 1. Properties specified in the //Properties// line of an Invoke Ant build task using (the equivalent of |
33 | |||
![]() |
49.1 | 34 | {{code language="none"}}-propertyfile <name>{{/code}}) |
![]() |
47.1 | 35 | ))) |
36 | 1. ((( | ||
37 | ====== Eclipse/WOLips ====== | ||
38 | |||
39 | 1. Properties specified for the Eclipse Workspace under Eclipse -> Preferences -> WOLips - > **System Frameworks** | ||
40 | 1. The | ||
41 | |||
![]() |
49.1 | 42 | {{code language="none"}}build.properties{{/code}} file in the same directory as the build.xml file as specified by |
![]() |
47.1 | 43 | |
![]() |
49.1 | 44 | {{code language="none"}}<property file="build.properties" />{{/code}} task in the build.xml file. |
![]() |
47.1 | 45 | ))) |
46 | 1. ((( | ||
47 | ====== Command Line ====== | ||
48 | |||
49 | 1. Properties specified in the Ant command: | ||
50 | |||
51 | {{code language="none"}} | ||
52 | -D<property>=<value> | ||
53 | {{/code}} | ||
![]() |
49.1 | 54 | |
![]() |
47.1 | 55 | 1. A properties file specified in the Ant command: |
56 | |||
57 | {{code language="none"}} | ||
58 | -propertyfile <name> | ||
59 | {{/code}} | ||
![]() |
49.1 | 60 | |
![]() |
47.1 | 61 | 1. The |
62 | |||
![]() |
49.1 | 63 | {{code language="none"}}build.properties{{/code}} file in the same directory as the build.xml file as specified by |
![]() |
47.1 | 64 | |
![]() |
49.1 | 65 | {{code language="none"}}<property file="build.properties" />{{/code}} task in the build.xml file. |
![]() |
47.1 | 66 | ))) |
67 | |||
68 | {{note title="Can't Find WebObjects"}} | ||
![]() |
37.1 | 69 | If Ant can't find the WebObjects frameworks, you will get compiler errors like this: |
![]() |
47.1 | 70 | |
71 | {{noformat}} | ||
![]() |
31.1 | 72 | [wocompile] /MyProjects/MyFramework/Sources/com/mycompany/myapp/myclass:10: |
73 | package com.webobjects.appserver does not exist | ||
![]() |
27.1 | 74 | [wocompile] import com.webobjects.appserver.WOContext; |
75 | |||
![]() |
47.1 | 76 | {{/noformat}} |
![]() |
27.1 | 77 | {{/note}} |
78 | |||
![]() |
37.1 | 79 | = Building = |
80 | |||
81 | === WOJenkins === | ||
82 | |||
83 | Using Jenkins is the recommended way to build a Framework and WOJenkins makes the process almost as easy as building from within Eclipse/WOLips. | ||
84 | |||
85 | === Eclipse/WOLips === | ||
86 | |||
![]() |
47.1 | 87 | * ((( |
88 | ===== Standard WebObjects Framework ===== | ||
89 | |||
![]() |
37.1 | 90 | Right-Click on your project in Eclipse and select **WOLips Ant Tools > Install** |
![]() |
47.1 | 91 | [[image:attach:WOLipsAntInstall.png]] |
![]() |
37.1 | 92 | This will build and install the framework in the location defined in the WOLips preferences, overwriting any previously installed version of the framework. |
93 | |||
![]() |
43.1 | 94 | {{note title="BUILD FAILED"}} |
![]() |
47.1 | 95 | If Ant can't write to the WebObjects frameworks directory, you will get an error like this: |
![]() |
43.1 | 96 | |
![]() |
47.1 | 97 | {{noformat}} |
![]() |
43.1 | 98 | Directory /Library/WebObjects/Versions/WebObjects543/Library/Frameworks/YourFramework.framework |
99 | creation was not successful for an unknown reason. | ||
![]() |
47.1 | 100 | |
101 | {{/noformat}} | ||
102 | |||
![]() |
45.1 | 103 | Give write access to the directory with these commands in Terminal: |
![]() |
47.1 | 104 | sudo chmod 757 /Library/WebObjects/Versions/WebObjects543/Library/Frameworks/ |
105 | sudo chmod 757 /Library/WebObjects/Versions/WebObjects543/Library/WebObjects/Applications | ||
![]() |
43.1 | 106 | {{/note}} |
![]() |
47.1 | 107 | ))) |
![]() |
43.1 | 108 | |
![]() |
47.1 | 109 | * ((( |
110 | ===== Project Wonder Frameworks ===== | ||
111 | |||
![]() |
37.1 | 112 | **You can not build projects from Wonder this way.** You must either use the command line or Hudson/Jenkins methods |
![]() |
47.1 | 113 | ))) |
![]() |
37.1 | 114 | |
![]() |
27.1 | 115 | === Command Line / Terminal === |
116 | |||
![]() |
47.1 | 117 | You have to install woproject.jar first and make it available for ant before the following instructions will work. (see [[doc:WEB.Building a WebObjects Project||anchor="Overview"]] first) |
![]() |
39.1 | 118 | |
![]() |
47.1 | 119 | * ((( |
120 | ===== Standard WebObjects Framework ===== | ||
121 | |||
![]() |
27.1 | 122 | You can build a standard WebObjects Framework project by calling Ant and passing it the Project directory, and the name of the build target contained in the build.xml file at your project's root. |
123 | |||
![]() |
47.1 | 124 | {{code 0="none"}} |
![]() |
27.1 | 125 | cd /my/project/ |
126 | ant build | ||
127 | |||
128 | {{/code}} | ||
129 | |||
![]() |
47.1 | 130 | By default, the built framework will be put in a {{code language="none"}}dist{{/code}} directory in your project's root. |
131 | ))) | ||
![]() |
27.1 | 132 | |
![]() |
47.1 | 133 | * ((( |
134 | ===== Project Wonder Frameworks ===== | ||
![]() |
27.1 | 135 | |
![]() |
49.1 | 136 | First download the Wonder source code (see [[doc:WEB.Home.Getting Started.Getting the Wonder Source Code.WebHome]]). Make a note of the location of the Wonder directory. |
![]() |
27.1 | 137 | |
![]() |
47.1 | 138 | The Wonder build script will use properties defined in ~~/Library/Application Support/WOLips/wolips.properties. This is a good place to set {{code language="none"}}wo.system.frameworks{{/code}} property. |
139 | |||
140 | To build Project Wonder's frameworks use these commands. | ||
141 | |||
142 | {{code 0="none"}} | ||
![]() |
27.1 | 143 | cd /path/to/Wonder |
144 | ant frameworks | ||
145 | |||
146 | {{/code}} | ||
147 | |||
![]() |
47.1 | 148 | By default, all the Wonder frameworks will be built to ({{code language="none"}}~/Roots{{/code}}) (in your home directory). To build elsewhere, set the {{code language="none"}}wo.external.root{{/code}} property. |
149 | ))) | ||
![]() |
27.1 | 150 | |
![]() |
31.1 | 151 | = Customizing the Build = |
![]() |
27.1 | 152 | |
![]() |
37.1 | 153 | By modifying the values in the build.properties and wolips.properties files or by passing in arguments to the Ant command, you can change where Ant will look for dependencies (binary frameworks, libraries, etc.) and where it will install the build products. |
![]() |
33.1 | 154 | |
![]() |
31.1 | 155 | = Installing = |
![]() |
27.1 | 156 | |
![]() |
31.1 | 157 | Assuming you already cloned and built Wonder from source using the method outlined above, you can use the following procedure pull the latest changes into your local repository. |
![]() |
27.1 | 158 | |
159 | ===== Install the frameworks ===== | ||
160 | |||
![]() |
47.1 | 161 | {{code 0="none"}} |
162 | sudo ant -Duser.home=$HOME frameworks.install | ||
![]() |
27.1 | 163 | {{/code}} |
164 | |||
![]() |
47.1 | 165 | This copies the built frameworks from {{code language="none"}}~/Roots{{/code}} to the runtime Frameworks directory: |
![]() |
27.1 | 166 | |
![]() |
47.1 | 167 | * Mac OS X: {{code language="none"}}/Library/Frameworks/{{/code}} or {{code language="none"}}/Library/WebObjects/Versions/WebObjects543/Library/Frameworks/{{/code}} |
168 | * Linux: {{code language="none"}}/Local/Library/Frameworks{{/code}} | ||
![]() |
27.1 | 169 | |
![]() |
47.1 | 170 | Setting the {{code language="none"}}user.home{{/code}} property is necessary. Otherwise {{code language="none"}}ant{{/code}} will think {{code language="none"}}user.home{{/code}} is {{code language="none"}}/var/root{{/code}} and {{code language="none"}}frameworks.install{{/code}} would look for built frameworks in {{code language="none"}}/var/root/Roots{{/code}} and would miss any custom locations set for {{code language="none"}}wo.local.frameworks{{/code}} that are set in your {{code language="none"}}wolips.properties{{/code}} file. |
171 | |||
![]() |
27.1 | 172 | You can combine the build and install steps by simply executing this Ant command: |
173 | |||
![]() |
47.1 | 174 | {{code 0="none"}} |
175 | sudo ant -Duser.home=$HOME frameworks frameworks.install | ||
![]() |
27.1 | 176 | {{/code}} |
177 | |||
178 | === Upgrading === | ||
179 | |||
180 | This will clean out the existing versions of the frameworks. This isn't strictly necessary, you could just re-install over the top of the old frameworks, but deleting then manually copying over the new ones will clean up any old frameworks that are no longer included in the standard build. | ||
181 | |||
![]() |
47.1 | 182 | 1. ((( |
183 | ===== Navigate to the original Wonder source directory that you created above during initial source installation ===== | ||
![]() |
27.1 | 184 | |
![]() |
47.1 | 185 | {{code 0="none"}} |
![]() |
27.1 | 186 | cd /path/to/WonderSource |
187 | {{/code}} | ||
![]() |
47.1 | 188 | ))) |
189 | 1. ((( | ||
190 | ===== Pull the changes you do not have and merge them with your local repository ===== | ||
![]() |
27.1 | 191 | |
![]() |
47.1 | 192 | {{code 0="none"}} |
![]() |
27.1 | 193 | git pull |
194 | {{/code}} | ||
![]() |
47.1 | 195 | ))) |
196 | 1. ((( | ||
197 | ===== Build the frameworks. ===== | ||
![]() |
27.1 | 198 | |
![]() |
47.1 | 199 | {{code 0="none"}} |
![]() |
27.1 | 200 | ant frameworks |
201 | {{/code}} | ||
![]() |
47.1 | 202 | ))) |
203 | 1. ((( | ||
204 | ===== Navigate to the Roots directory that was automatically created by the initial Source installation procedure above ===== | ||
![]() |
27.1 | 205 | |
![]() |
47.1 | 206 | {{code 0="none"}} |
![]() |
27.1 | 207 | cd ~/Roots/ |
208 | {{/code}} | ||
![]() |
47.1 | 209 | ))) |
210 | 1. ((( | ||
211 | ===== Delete all installed frameworks whose names match the built frameworks in this Roots build folder ===== | ||
![]() |
27.1 | 212 | |
![]() |
47.1 | 213 | {{code 0="none"}} |
![]() |
27.1 | 214 | for FRAMEWORK in `echo *.framework`; do sudo rm -r /Library/Frameworks/${FRAMEWORK}; done |
215 | {{/code}} | ||
![]() |
47.1 | 216 | ))) |