This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Building OpenContent as an Alfresco Subsystem
jharkins2 edited this page Jul 31, 2018
·
21 revisions
OpenContent is deployed as an Alfresco Subsystem, so building it is different than building an OpenContent.war file. We will install it using Gradle.
- Install Alfresco using the installer for your OS.
- Once Alfresco is installed, pull down OpenContent:
- In order to support version specific OC code changes to configuration or java source code (needed for facets, for example) we have implemented an overlay system for the 2.alfrescoEmb module. By specifying the target Alfresco version you are installing OC into in your project build.gradle the build will pick up any files specified in the matching version directory in 2.alfrescoEmb/alfresco-overlays. For example, if I set my version to 4.2.3 it will look for an alfresco-overlays/4.2.3 folder and extract any included configs or java sources before compilation / AMP creation.
- Also note that web-fragment.xml deployment will automatically happen if the flag is set in your project's build.gradle.
IMPORTANT: You must build with at least Java 7 for Alfresco 4.2+ or the build will fail. If you are building with Alfresco 4.0.x or 4.1.x, you must use Java 6.
- Start up Alfresco normally to allow it to initialize and create the database. Log in to verify a successful installation.
- Shutdown Alfresco.
- Navigate to the project directory you want to install: e.g. OC/projects/clients/cmhr or OC/projects/tsg/hpiAlfresco 1.Create a build-{YOURCOMPUTERNAME}.properties file and create the alfrescoHome property:
-
alfrescoHome
: points to the root alfresco directory (where tomcat and alf_data are contained, e.g. C:/Alfresco/alfresco-enterprise-4.2.1)
- Ensure that the project you are building contains a module-context.xml file for the alfresco subsystem to load. A sample can be found in 2.alfrescoEmb named module.context.xml.sample that you can use.
- Verify that your compiled Alfresco version matches the deployment target. Consider the following:
SPRING VERSION: 3.0.5.RELEASE
DFC VERSION: 6.7.sp1
ALFRESCO VERSION: 4.2.3.1
ALFRESCO HOME: /home/work/alfresco/wizard-alfresco-4.2.3
ACTIVITI VERSION: 5.13-alf-20140107
ALFRESCO VERSION matches the ALFRESCO_HOME. This is configured in your build-{YOURCOMPUTERNAME} like so:
overlay=cambridge
alfrescoHome=/home/work/alfresco/wizard-alfresco-4.2.3
deployWebXml=true
alfrescoVersion=4.2.3.1
see Note on Alfresco Version Overlays for details.
- Run any of the following gradle tasks from cmd line while inside your project directory:
-
gradle installAmp
- Builds the Alfresco amp and installs it into alfresco.war, creating a backup of the old war. Deletes your ALFRESCO_HOME/webapps/alfresco directory. Gradle does not delete quickly, so feel free to delete alfresco directory yourself to save build time. -
gradle installDevelopmentAmp
- Deploys files directly into your exploded webapp. Does not backup the old webapp or war. Use only for development. -
gradle amp
- Packages the amp into the build/distributions folder. You can manually install the amp using the instructions found here.
- Startup Alfresco to explode your war if it is not already exploded. Make sure there are no errors in the alfresco.log during startup.
- Ensure that the OpenContent web-fragment.xml exists inside the exploded alfresco war as described here. If not, build your project with the deployWebFragmentXML set to "true"
- Shutdown Alfresco.
- Open ALFRESCO_HOME/tomcat/webapps/alfresco/WEB-INF/web.xml
- Open OC_TRUNK/war/WEB-INF/web.xml.
- Copy the
<servlet>
and<servlet-mapping>
xml nodes from the source code web.xml to Alfresco's web.xml and save. - Alternatively, copy the
<servlet>
and<servlet-mapping>
nodes from here.
- Start Alfresco and verify that you can hit REST endpoints (or try to logging in to HPI).
OpenContent (OC) © 2016 Technology Services Group