Building Opencms 9.5.x from the sources

From OpenCms Wiki
(Difference between revisions)
Jump to: navigation, search
m (move sha to footnote)
m (Add note about status of these instructions)
 
(19 intermediate revisions by one user not shown)
Line 1: Line 1:
<small>Note: this is work in progress!</small>
+
= Building opencms-core (Outdated) =
 
+
= Building opencms-core =
+
  
 
<em>Note: This build process has been tested for Java versions 7 and 8, and Gradle versions 1.8 and 2.1.</em>
 
<em>Note: This build process has been tested for Java versions 7 and 8, and Gradle versions 1.8 and 2.1.</em>
 +
<em>Note 2016-03-31: This description is outdated, as there has been new OpenCms releases that fixed some of the issues mentioned below. With current OpenCms releases, it should suffice to invoke <tt>gradle bindist</tt> to build the binary distribution from the sources. I'll keep these instructions though, as they contain some practical tips / workarounds if something gets nasty again.</em>
 +
  
 
=== Checkout, fix if necessary and install the Alkacon Acacia Editor ===
 
=== Checkout, fix if necessary and install the Alkacon Acacia Editor ===
Line 12: Line 12:
  
 
  pushd ~/src
 
  pushd ~/src
  git clone https://github.com/alkacon/acacia-editor.git -b opencms_9_4_7 acacia-editor-opencms-9-4-7
+
  git clone https://github.com/alkacon/acacia-editor.git -b opencms_9_4_7 acacia-editor-opencms_9.4.7
  cd acacia-editor-opencms-9-4-7
+
  cd acacia-editor-opencms_9.4.7
  
 
If you're using Java 8, apply the [https://github.com/alkacon/acacia-editor/pull/4 patch to work around the javadocs]:
 
If you're using Java 8, apply the [https://github.com/alkacon/acacia-editor/pull/4 patch to work around the javadocs]:
Line 27: Line 27:
 
=== Checkout the sources of the ms_9_4_7 tag<sup>[[#note1|1]], [[#note2|2]], [[#note3|3]]</sup> ===
 
=== Checkout the sources of the ms_9_4_7 tag<sup>[[#note1|1]], [[#note2|2]], [[#note3|3]]</sup> ===
  
  git clone https://github.com/alkacon/opencms-core.git -b ms_9_4_7
+
  git clone https://github.com/alkacon/opencms-core.git -b ms_9_4_7 opencms-core-ms_9.4.7
  
 
After checkout, cd into the new directory
 
After checkout, cd into the new directory
  
  cd opencms-core
+
  pushd opencms-core-ms_9.4.7
  
 
=== Adjust if necessary the versioning configuration ===
 
=== Adjust if necessary the versioning configuration ===
  
Edit the file <tt>opencms/src/org/opencms/main/version.properties</tt> or edit and execute the script <tt>create_version_properties.sh</tt>
+
Edit the file <tt>src/org/opencms/main/version.properties</tt> or edit and execute the script <tt>create_version_properties.sh</tt>
  
 
=== Execute the gradle <tt>bindist</tt> task ===
 
=== Execute the gradle <tt>bindist</tt> task ===
Line 41: Line 41:
 
  gradle bindist
 
  gradle bindist
  
: <em>Tip for developers</em>: Gwt generates code for all the possible permutations of the supported languages and browsers. This compilation takes a significant part of the complete build time. During development builds you could find useful to generate the corresponding gwt code only for a language and a browser restricting the value of the properties <strong><tt>locale</tt></strong> and <strong><tt>user.agent</tt></strong> to only one value in the file <strong><tt>opencms-core/src-gwt/org/opencms/GwtBase.gwt.xml</tt></strong>.
+
: <em>Tip for developers</em>: Gwt generates code for all the possible permutations of the supported languages and browsers. This compilation takes a significant part of the complete build time. During development builds you could find useful to generate the corresponding gwt code only for a language and a browser restricting the value of the properties <strong><tt>locale</tt></strong> and <strong><tt>user.agent</tt></strong> to only one value in the file <strong><tt>src-gwt/org/opencms/GwtBase.gwt.xml</tt></strong>.
  
 
Once this task is finished, you should have (among others) a <tt>distributions</tt> directory under your (in the property <tt>build_directory</tt> of the file <tt>gradle.properties</tt>) configured build directory, containing the distributable <tt>opencms-[version].zip</tt> and the deployable '''<tt>opencms.war</tt>'''.
 
Once this task is finished, you should have (among others) a <tt>distributions</tt> directory under your (in the property <tt>build_directory</tt> of the file <tt>gradle.properties</tt>) configured build directory, containing the distributable <tt>opencms-[version].zip</tt> and the deployable '''<tt>opencms.war</tt>'''.
Line 53: Line 53:
 
= Building alkacom-oamp =
 
= Building alkacom-oamp =
  
=== Checkout the sources of the 9_5_x branch<sup>[[#note6|6]]</sup> ===
+
<small>Note: This section is unfinished --and will probably stay so forever unless the pull request indicated below undergoes a code review--, as I have only managed to compile the sources but couldn't understand exactly how the ADE editor works to solve the presentation glitches of the Serial Events Editor.</small>
  
  git clone https://github.com/alkacon/alkacon-oamp.git -b branch_9_5_x alkacon-oamp-9_5_x
+
=== Checkout the sources of the 9_5_x branch<sup>[[#note5|5]]</sup> ===
 +
 
 +
popd
 +
  git clone https://github.com/alkacon/alkacon-oamp.git -b branch_9_5_x alkacon-oamp-9.5.x
  
 
After checkout, cd into the new directory
 
After checkout, cd into the new directory
  
  cd alkacon-oamp-9_5_x
+
  pushd alkacon-oamp-9.5.x
 +
 
  
 
=== Patch the code ===
 
=== Patch the code ===
  
Unfortunatelly, the current sources ([https://github.com/alkacon/alkacon-oamp/commit/98dffd71bdfe51f95d9b1a39fda3c7084c08bb5f <tt>98dffd71tt>] as for 2014-10-07) still do not compile. Until Alkacon fixes them, I have written a few more patches as workarounds:
+
To compile the gwt code, you need to apply this pull request:
  
* [https://github.com/alkacon/alkacon-oamp/pull/32 #32]
+
* [https://github.com/alkacon/alkacon-oamp/pull/47 #47]
  
Additionally, if you are using Gradle 2.0+, you'll need the patch:
+
To apply it, fetch it and merge it into your working branch:
  
* [https://github.com/alkacon/alkacon-oamp/pull/30 #30] (See also the thread [http://opencms.996256.n3.nabble.com/OpenCms-9-0-1-ready-for-download-tp23958p24010.html OpenCms 9.0.1 ready for download])
+
git fetch origin pull/47/head
 +
 +
# "--no-edit" to accept default commit message (batch mode)
 +
git merge --no-edit -s recursive -X ignore-space-at-eol FETCH_HEAD
  
And finally, if you are using Java 8+, you'll also need patches:
 
  
* [https://github.com/alkacon/alkacon-oamp/pull/34 #34]
+
=== Customization ===
* [https://github.com/alkacon/alkacon-oamp/pull/35 #35]
+
  
To apply the patches, fetch them and merge them into your working branch. For example, to apply patch 32:
+
Edit if necessary the build properties to match versions (see [[#note6|note 6]]).
  
git fetch origin pull/32/head
 
git merge FETCH_HEAD
 
  
 
=== Execute the gradle <tt>bindist</tt> task ===
 
=== Execute the gradle <tt>bindist</tt> task ===
 +
 +
Now you should be able to build the distributable files:
  
 
  gradle bindist
 
  gradle bindist
 +
 +
If everything has worked, you should now have the distributable files under your configured build directory (defined under <tt>build_directory</tt> in <tt>gradle.properties</tt>)
  
 
= Notes =
 
= Notes =
Line 130: Line 137:
 
I have written a pull-request to work around this issue: https://github.com/alkacon/opencms-core/pull/278. Please note that this pull is for the branch <tt>branch_9_5_x</tt>. Be warned that merging it into a branch based upon the tag <tt>ms_9_4_7</tt> will also merge all the changes between commits <tt>ms_9_4_7..branch_9_5_x</tt>.
 
I have written a pull-request to work around this issue: https://github.com/alkacon/opencms-core/pull/278. Please note that this pull is for the branch <tt>branch_9_5_x</tt>. Be warned that merging it into a branch based upon the tag <tt>ms_9_4_7</tt> will also merge all the changes between commits <tt>ms_9_4_7..branch_9_5_x</tt>.
  
That is, if you want to pull the whole changes:
+
That is, if you want to pull the whole changes ('''not recommended''', as alkacon-oamp is as for today not yet compatible with opencms-core branch_9_5_x):
  
 
  git fetch origin pull/278/head
 
  git fetch origin pull/278/head
 
  git merge FETCH_HEAD
 
  git merge FETCH_HEAD
  
If you only want the changes from this patch:
+
If you only want the changes from this patch (recommended and tested):
  
 
  git fetch origin pull/278/head
 
  git fetch origin pull/278/head
 
  git cherry-pick origin/branch_9_5_x..FETCH_HEAD
 
  git cherry-pick origin/branch_9_5_x..FETCH_HEAD
  
<span id="note5">5</span>. You need to match the version of the generated opencms-core artifacts to the version of the alkacon-oamp dependencies. Since commit [https://github.com/alkacon/opencms-core/commit/89e10779f43cd8bcc31f7db9d60193a89994c948 <tt>89e10779</tt>] (from 2014-04.02, already in <tt>branch_9_5_x</tt>), the property <tt>version.number</tt> in the file <tt>opencms-core/src/org/opencms/main/version.properties</tt> defines the versions of the opencms-core artifacts. The property <tt>opencms_version</tt> of the file <tt>alkacon-oamp/gradle.properties</tt> declares the version of the dependencies:
+
<span id="note5">5</span>. Unfortunatelly, Alkacon has not tagged this repository yet for opencms 9+. The repository has been apparently tagged on a component basis, independently of the <tt>opencms-core</tt> development. This makes difficult to pick any of the existing tags without knowing beforehand if all the components are in a sane and stable state.
 +
 
 +
This instructions are based on the latest revision as for 2014-10-16: [https://github.com/alkacon/alkacon-oamp/commit/98dffd71bdfe51f95d9b1a39fda3c7084c08bb5f #98dffd7]. To match your version to this one, after cloning the repository you can also use this commit as basis:
 +
 
 +
git checkout 98dffd71bdfe51f95d9b1a39fda3c7084c08bb5f
 +
 
 +
 
 +
<span id="note6">6</span>. You need to match the version of the generated opencms-core artifacts to the version of the alkacon-oamp dependencies. Since commit [https://github.com/alkacon/opencms-core/commit/89e10779f43cd8bcc31f7db9d60193a89994c948 <tt>89e10779</tt>] (from 2014-04.02, already in <tt>branch_9_5_x</tt>), the property <tt>version.number</tt> in the file <tt>opencms-core/src/org/opencms/main/version.properties</tt> defines the versions of the opencms-core artifacts. The property <tt>opencms_version</tt> of the file <tt>alkacon-oamp/gradle.properties</tt> declares the version of the dependencies:
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 173: Line 187:
 
  [...]
 
  [...]
 
|}
 
|}
 
<span id="note6">6</span>. Unfortunatelly, Alkacon has not tagged this repository yet for opencms 9+. The repository has been apparently tagged on a component basis, independently of the opencms-core development. This makes difficult to pick any of the existing tags without knowing beforehand if all the components are in a sane and stable state.
 
  
 
[[Category:Developing in OpenCms]]
 
[[Category:Developing in OpenCms]]

Latest revision as of 15:45, 31 March 2016

Contents

Building opencms-core (Outdated)

Note: This build process has been tested for Java versions 7 and 8, and Gradle versions 1.8 and 2.1. Note 2016-03-31: This description is outdated, as there has been new OpenCms releases that fixed some of the issues mentioned below. With current OpenCms releases, it should suffice to invoke gradle bindist to build the binary distribution from the sources. I'll keep these instructions though, as they contain some practical tips / workarounds if something gets nasty again.


Checkout, fix if necessary and install the Alkacon Acacia Editor

Both opencms-core ms_9_4_7 and the com.alkacon.opencms.v8.calendar module depend on the Alkacon online editor Acacia. This dependency has not yet been uploaded to the maven repository, so you have to build and install it yourself.

Checkout the version tagged opencms_9_4_7 of the acacia-editor:

pushd ~/src
git clone https://github.com/alkacon/acacia-editor.git -b opencms_9_4_7 acacia-editor-opencms_9.4.7
cd acacia-editor-opencms_9.4.7

If you're using Java 8, apply the patch to work around the javadocs:

git fetch origin pull/4/head
git merge FETCH_HEAD

And install the jars:

gradle install
popd

Checkout the sources of the ms_9_4_7 tag1, 2, 3

git clone https://github.com/alkacon/opencms-core.git -b ms_9_4_7 opencms-core-ms_9.4.7

After checkout, cd into the new directory

pushd opencms-core-ms_9.4.7

Adjust if necessary the versioning configuration

Edit the file src/org/opencms/main/version.properties or edit and execute the script create_version_properties.sh

Execute the gradle bindist task

gradle bindist
Tip for developers: Gwt generates code for all the possible permutations of the supported languages and browsers. This compilation takes a significant part of the complete build time. During development builds you could find useful to generate the corresponding gwt code only for a language and a browser restricting the value of the properties locale and user.agent to only one value in the file src-gwt/org/opencms/GwtBase.gwt.xml.

Once this task is finished, you should have (among others) a distributions directory under your (in the property build_directory of the file gradle.properties) configured build directory, containing the distributable opencms-[version].zip and the deployable opencms.war.

Install the jars in your local maven repository if necessary4, 5

If you want to also build the opencms oamp, v8 or v7 modules, you also need to install in your local maven repository the corresponding jars

gradle install

Building alkacom-oamp

Note: This section is unfinished --and will probably stay so forever unless the pull request indicated below undergoes a code review--, as I have only managed to compile the sources but couldn't understand exactly how the ADE editor works to solve the presentation glitches of the Serial Events Editor.

Checkout the sources of the 9_5_x branch5

popd
git clone https://github.com/alkacon/alkacon-oamp.git -b branch_9_5_x alkacon-oamp-9.5.x

After checkout, cd into the new directory

pushd alkacon-oamp-9.5.x


Patch the code

To compile the gwt code, you need to apply this pull request:

To apply it, fetch it and merge it into your working branch:

git fetch origin pull/47/head

# "--no-edit" to accept default commit message (batch mode)
git merge --no-edit -s recursive -X ignore-space-at-eol FETCH_HEAD


Customization

Edit if necessary the build properties to match versions (see note 6).


Execute the gradle bindist task

Now you should be able to build the distributable files:

gradle bindist

If everything has worked, you should now have the distributable files under your configured build directory (defined under build_directory in gradle.properties)

Notes

1. Checking out the build tagged build_9_0_1 and executing gradle fails with the following message (see post OpenCms 9.0.1 ready for download):

> Could not find property 'distribution' on configuration ':compile'.

2. In the branch branch_9_0_x this issue is fixed, but there is still an ISO encoded file test/org/opencms/search/extractors/TestMsPowerPointExtraction.java that breaks the javadocs:

[...]
:javadocTest
/home/myuser/src/opencms-9.0.x/opencms-core/test/org/opencms/search/extractors/TestMsPowerPointExtraction.java:93: error: unmappable character for encoding UTF8
        // this is "�������"
                    ^
/home/myuser/src/opencms-9.0.x/opencms-core/test/org/opencms/search/extractors/TestMsPowerPointExtraction.java:93: error: unmappable character for encoding UTF8
       // this is "�������"
                    ^
[...]
14 errors
:javadocTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':javadocTest'.
> Javadoc generation failed.

The commit 89e10779 fixes the encoding, but it hasn't made it into branch_9_0_x. Currently (2014-10-08) it is only available in tag ms_9_4_7 and branch branch_9_5_x.

3. For the sake of stability, I favor tagged versions over branches, that is tag ms_9_4_7 over branch branch_9_5_x. (There is unfortunately no tags for the branch_9_5 branch yet.)

4. The current javadocs are broken and when using Java 8+, gradle fails with the following message:

[...]
100 errors
100 warnings
:javadoc FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':javadoc'.
[...]

I have written a pull-request to work around this issue: https://github.com/alkacon/opencms-core/pull/278. Please note that this pull is for the branch branch_9_5_x. Be warned that merging it into a branch based upon the tag ms_9_4_7 will also merge all the changes between commits ms_9_4_7..branch_9_5_x.

That is, if you want to pull the whole changes (not recommended, as alkacon-oamp is as for today not yet compatible with opencms-core branch_9_5_x):

git fetch origin pull/278/head
git merge FETCH_HEAD

If you only want the changes from this patch (recommended and tested):

git fetch origin pull/278/head
git cherry-pick origin/branch_9_5_x..FETCH_HEAD

5. Unfortunatelly, Alkacon has not tagged this repository yet for opencms 9+. The repository has been apparently tagged on a component basis, independently of the opencms-core development. This makes difficult to pick any of the existing tags without knowing beforehand if all the components are in a sane and stable state.

This instructions are based on the latest revision as for 2014-10-16: #98dffd7. To match your version to this one, after cloning the repository you can also use this commit as basis:

git checkout 98dffd71bdfe51f95d9b1a39fda3c7084c08bb5f


6. You need to match the version of the generated opencms-core artifacts to the version of the alkacon-oamp dependencies. Since commit 89e10779 (from 2014-04.02, already in branch_9_5_x), the property version.number in the file opencms-core/src/org/opencms/main/version.properties defines the versions of the opencms-core artifacts. The property opencms_version of the file alkacon-oamp/gradle.properties declares the version of the dependencies:

opencms-core/src/org/opencms/main/version.properties alkacon-oamp/gradle.properties
# Static version information file
#
# You should set this to something meaningful before you build.
version.number=9.5.x
version.id=Manual build
build.number=(not set)
build.date=(not set)
nicename.build.number=Build Number
nicename.build.date=Build Date
# This has no nice name on purpose (for test cases)
build.info=Static version file
build_directory=../../BuildOAMP
opencms_version=9.5.x
java_target_version=1.6
max_heap_size=1024m

# all available modules
modules_oamp_all=\
com.alkacon.opencms.commons,\
com.alkacon.opencms.calendar,\
com.alkacon.opencms.documentcenter,\
[...]
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox