forked from Jahia/jahia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
executable file
·375 lines (268 loc) · 16.7 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
==============================================================================
README FOR DIGITAL EXPERIENCE MANAGER SOURCE CODE
==============================================================================
All source code, binaries and documentation is copyrighted (c) 2002-2016 by
Jahia Solutions Group SA. All Rights Reserved.
INTRODUCTION
------------------------------------------------------------------------------
Welcome to Jahia's source code!
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Commercial and Supported Versions of the program (dual licensing):
alternatively, commercial and supported versions of the program may be used
in accordance with the terms and conditions contained in a separate
written agreement between you and Jahia Solutions Group SA.
If you are unsure which license is appropriate for your use,
please contact the sales department at [email protected].
You must comply to the agreement before using this
code in any way, including reading it. Sorry for the mumble jumbo but there
are people trying to make a living while producing this code and would like
to bring more so it helps if people play fair :)
USING THIS SOURCE CODE (QUICKSTART)
------------------------------------------------------------------------------
Requirements:
- JDK 1.7 or later
- Maven 3.3.x or later
- Subversion client (for Windows at http://www.collab.net/downloads/subversion/
for Mac OS X from http://www.finkproject.org/ or Xcode tools, under
Linux install a subversion client from your package repository). Basically,
you need to have an "svn" command available in your PATH so that the build
system can calculate the build number
- (Optional) JetBrains IntelliJ IDEA 7.0.3 or later
Here is quick start steps to use this source code:
1. Make sure you have all the above requirements, especially the Subversion
client!
2. Code to checkout:
http://subversion.jahia.org/svn/jahia/trunk/
For more information, please check the template developer guide.
3. Download and Install Maven 3.3.x or later (http://maven.apache.org), and set an
M2_HOME environment variable pointing at the installation
directory. Put M2_HOME/bin folder in path. Also increase the
memory for Maven by setting the following environment variable:
MAVEN_OPTS=-Xmx1024m
4. Download and Install a Java JDK (http://www.oracle.com/technetwork/java/javase/downloads/index.html).
Configure the JDK by installing a JAVA_HOME environment variable pointing to it's
installation directory.
- Under Windows:
right-click "My Computer", select "Properties", "Advanced",
"Environment", add a variable to the user or system settings with
the following value: name=JAVA_HOME, value=YOUR_PATH_TO_THE_JDK
where YOUR_PATH_TO_THE_JDK could be something like
C:\Java\jdk1.6.0_24 if you've installed JDK 1.6.0 update 24.
- Under Linux:
Add the following like to the /etc/profile configuration file
(close for example to where the PATH is declared):
JAVA_HOME=YOUR_PATH_TO_THE_JDK
You could also add this environment variable to your
~/bash_profile.
- Other unix systems:
Basically the same as under Linux, set the environement variable
JAVA_HOME to point to your JDK installation.
5. Copy the settings.example.xml file into ${USER_HOME}/.m2 directory, renaming
it to settings.xml, and modify it to your environment.
As there are problems with JSP compilation on path with spaces on Windows environments, it is
recommended you specify a default location for your local repository
that DOESN'T CONTAIN ANY SPACES IN THE PATH, for example:
C:/development/m2repository
6. When you use a new Tomcat server make sure you give it enough memory and adjust its options.
This can be increase by editing bin/catalina.sh and add the following lines:
CATALINA_OPTS="$CATALINA_OPTS -Xms1024m -Xmx1024m -Djava.awt.headless=true -XX:MaxPermSize=256m -server -Dhibernate.jdbc.use_streams_for_binary=true -verbose:gc"
export CATALINA_OPTS
CATALINA_PID=/tmp/jahia-6.5.pid
export CATALINA_PID
before the line
# OS specific support.
On Windows systems, edit the bin\catalina.bat file and add:
set CATALINA_OPTS=%CATALINA_OPTS% -Dsun.io.useCanonCaches=false -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -server -Dhibernate.jdbc.use_streams_for_binary=true -verbose:gc
before the line
rem Guess CATALINA_HOME if not defined
If using embedded Derby database, please specify the correct Derby home folder in the
Tomcat startup options by adding into bin/catalina.sh:
CATALINA_OPTS="$CATALINA_OPTS -Dderby.system.home=$CATALINA_HOME/webapps/ROOT/WEB-INF/var/dbdata"
export CATALINA_OPTS
on Windows by adding into bin\catalina.bat:
set CATALINA_OPTS=%CATALINA_OPTS% -Dderby.system.home=%CATALINA_HOME%\webapps\ROOT\WEB-INF\var\dbdata
7. In the main directory, type:
mvn install jahia:deploy jahia:configure
This should compile and deploy into your local repository all of Jahia, deploy and install everything in the
application server configured in your settings.xml file.
An purely indicative time of initial compilation time (including all
dependency download) is 16 minutes. A "mvn clean install" on the same
machine takes 2 minutes 40 seconds. These times do not include JSP or
GWT compilation.
8. Point your browser to http://localhost:8080/
Default root password is root1234
9. Create your first virtual site and enjoy.
Using IDEs
------------------------------------------------------------------------------
IDEA:
1. IDEA has direct support for Maven, so you can simply open the project
using the IDE.
Here are the steps to create the new project:
- Open File -> New Project ...
- Select Import project from external model
- Click Next
- Select Maven
- Click Next
- Select directory where source was checked out and check the box
named "Automatically synchronize maven structure on startup"
- It should find just one project org.jahia.server:jahia-root
- Click next
- For the project name you can leave the default
- Click finish
If you have trouble with the above procedure, you can also generate
the IDEA project structure using the Maven IDEA plugin this way:
mvn idea
You can find the plugin documentation here:
http://maven.apache.org/plugins/maven-idea-plugin/
Eclipse:
1. Add a new 'M2_REPO' classpath variable in Eclipse, pointing to your
Maven repository folder (either using Maven or manually):
a) Using Maven: execute:
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
where <path-to-eclipse-workspace> is the path to your Eclipse workspace
b) Manually: in Eclipse open
Window / Preferences -> Java -> Build Path -> Classpath Variables.
Click on 'New...'
and enter M2_REPO as a name of the variable and full path to your
Maven repository as path value
2. In the Jahia root folder execute the following command:
mvn eclipse:eclipse
This will generate '.project' and '.classpath' files for the seven
projects in Jahia (jackrabbit-core-ext, jackrabbit-server-ext,
jahia-api, jahia-ear, jahia-impl, jahia-war, etc.)
3. Open Eclipse and use import 'Existing Projects into Workspace'.
Using 'Browse...' select the Jahia root folder. A list of available
projects will be shown. Import projects into the workspace.
Setup Maven deployment configuration
------------------------------------------------------------------------------
In order to be able to deploy to the Jahia Maven repository, you must have setup a public/private
key pair in your settings.xml file. In order to do this you must first generate a public/private
key pair if you don't have one.
In order to do deployments to the maven repository, you need to have a public/private key pair setup on
your machine and setup the correct authorization on the remote machine.
1. ssh-keygen -b 2048 -t rsa
* If you want the key to be used in an automated setting, use an empty passphrase when the program asks for it (i.e., hit enter at the prompt without typing anything else first).
2. Append the public key (id_rsa.pub) to your <path to user home>/.ssh/authorized_keys file on the remote machine. If you don't already have the directory or the file, first create the <path to user home>/.ssh/ directory, then copy the id_rsa.pub file to the remote machine, and finally rename it to <path to user home>/.ssh/authorized_keys.
3. Add the following information in your ${USER_HOME}/.m2/settings.xml file :
<servers>
<server>
<id>jahiaRepository</id>
<username>YOUR_USERNAME</username>
<privateKey>${user.home}/.ssh/id_rsa</privateKey> <!-- not needed if using pageant -->
</server>
</servers>
Developing and running unit tests
------------------------------------------------------------------------------
Tests are all packaged in the test module. They are intended to be executed in a live jahia context, and are able to
test any stuff on the server side, from a simple DAO to a high end service.
Adding a new test simply consist in adding a TestCase class in the test module. All tests commited in the test module
will be executed automatically after each build on the Bamboo server.
The existing tests are using the templates-web module, which needs to be deployed on your Jahia server. The module
can be downloaded here: https://devtools.jahia.com/nexus/content/groups/public/org/jahia/modules/templates-web/
The source of the templates-web module is on github: https://github.com/Jahia/templates-web
To manually run the tests:
- Go to the test module, execute:
mvn install jahia:deploy -Djahia.deploy.deployTests
( note that class hotswap is also working for this module, test code change won't require a jahia restart )
- Startup your jahia
- Execute:
All tests: mvn jahia:test surefire-report:report-only
or one single test: mvn -Dtest=org.jahia.services.stuff.MyTest jahia:test surefire-report:report-only
The plugin will use the url set in the parameter " <jahia.test.url> " in your settings.xml file
- Open the file target/site/surefire-report.html and look at the result.
- To execute selenium tests, server selenium is require. You have to download selenium RC here: http://seleniumhq.org/download/
This tests are configure to be run through http://localhost:8080/cms
Code coverage generation
------------------------------------------------------------------------------
Jahia's maven project structure is now integrated with the Atlassian Clover
reporting tool. The new "code-coverage" profile must be activated in your
settings.xml. You must also add the following plugin group in the same file:
<pluginGroup>com.atlassian.maven.plugins</pluginGroup>
In your Tomcat, add to the shared library directory the clover*.jar that you
should find in your Maven repository in the
.m2/repository/com/cenqua/clover/clover/2.4.2
directory. Deploy to tomcat/shared/lib under Tomcat 5.x and under tomcat/lib
under Tomcat 6.x.
Then do from root:
mvn clean install -P testJahia
This will deploy jahia,start your tomcat and stop it, and then undeploy jahia.
The resulting report will be generated in target/site/clover/ for clover and in
the file target/site/surefire-report.html and look at the test result.
WARNING: Clover will instrument your code in your local repository, meaning
that the JARs will contain code to analyse the code's behavior and also
hardcoded paths to store the analysis results. So you should NEVER upload
instrumented JARs to the remote repository, because they will simply not work.
It might be a good idea, when compiling for code coverage, to use an
alternate remote repository. You can do this by using the following command
line argument:
-Dmaven.repo.local=/home/myusername/.m2/repository-for-clover
Troubleshooting
------------------------------------------------------------------------------
If you encounter javascript errors, java exceptions related to an AJAX class,
or any other engine GUI problem, it is likely that you have upgraded your
Jahia server without emptying the browsers'cache. Before requesting support,
try the following:
1. Empty the browser cache using the browsers options. The option to empty the cache
is usually located in the "privacy options".
2. Close all browsers windows.
3. Restart your browser and try again. If the problem persists, please contact us.
Version numbering
------------------------------------------------------------------------------
We following the following convention for version numbering :
MAJOR.MINOR.SERVICEPACK.PATCH
Please respect this when performing releases so that all the parsing code
works correctly.
Performing a release with the Maven Release plugin
------------------------------------------------------------------------------
It is now possible to use the Maven Release plugin to automate the build of
a release. This will change all the pom.xml versions, commit the change,
compile the project, create a tag and then change all the pom.xml back to
a SNAPSHOT version and commit again.
But before we do this, there are a few changes we must do to the Jahia
project :
1. Create the adequate license.xml files
2. Commit the changes and then use the Maven Release Plugin (see below) to
perform the rest of the release
3. It is recommended also to do all the following steps on a clean checkout of
the codebase, as in your working directory you might have local changes or
IDE project files that will conflict with proper preparation. You can for example
checkout the project like this :
svn checkout https://username@svnserver/svn/jahia/trunk
You will probably want to also test a commit to make sure you have setup everything
properly before running the Maven release plugin
4a. If you're not familiar with the release plugin or want to simply double-check things, you can perform first
a dry run with the command :
mvn -DdryRun release:prepare -P installer,windows-installer,qa-build,test
Once it is completed reset the project by using the command :
mvn release:clean -P installer,windows-installer,qa-build,test
4b. You can perform all this with the following command line :
mvn release:prepare -P installer,windows-installer,qa-build,test
When asked for versions, here is an example :
There are still some remaining snapshot dependencies.
: Do you want to resolve them now? (yes/no) no: : yes
Dependency type to resolve,: specify the selection number ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ): (0/1/2/3) 1: :
What is the release version for "Jahia Project Root"? (org.jahia.server:jahia-root) 6.5: : 6.5-BETA2
What is SCM release tag or label for "Jahia Project Root"? (org.jahia.server:jahia-root) jahia-root-6.5-BETA2: : JAHIA_6_5_BETA2
What is the new development version for "Jahia Project Root"? (org.jahia.server:jahia-root) 6.5-BETA3-SNAPSHOT: : 6.5-SNAPSHOT
5. Test a staging of the release by doing the following :
mvn -DstagingRepository=stagingDir::default::file:///Users/loom/java/temp release:stage
6. Once everything looks right, you can perform the release by doing :
mvn release:perform
This step requires that you have correctly setup deployment to the Maven repository
as described in this README in the section called "Deploying new JARs to maven.jahia.org"
Tips :
- If for some reason you need to start again you can use the release:clean or
if something was already committed, prepare a rollback with release:rollback
- If you want to perform staging on a specific tag, here is an example :
mvn -DconnectionUrl=scm:svn:https://devtools.jahia.com/svn/jahia/tags/JAHIA_6_5_BETA2 -DstagingRepository=stagingDir::default::file:///Users/loom/java/temp release:stage
- If you're running of these an the Bamboo server, make sure you use the alternate local repository with the following
command line option : -Dmaven.repo.local=/home/bamboo/.m2/repository-for-package