Search This Blog

About Me

Highly experienced in implementation and customization of Alfresco. More than 11 years of experience working on Alfresco, versions ranging from 2.x to 5.x. Successfully processed innovative and tailored CMS solutions to meet ever-changing business requirements for multiple clients. Role Includes : Experience in Alfresco Upgrades, SOLR migration, Proposals, Team Handling, Delivery, Content Migration, POC's etc.. Extensive experience in client co ordination, working on offshore-onshore model and project take over. Technical Expertise Includes : Java, JSP, Servlet, JSF, JavaScript, AJAX, Spring, SQL, Hibernate, Web Services(REST). Specialities Includes : Content Migration, Product Customization, Business CMS Solutions, Workflow, Project Transition.

Tuesday, February 7, 2017

Alfresco Community Upgrade from 4.2.e to 5.0.0

I am writing this blog with reference to my recent practice activity of upgrade from alfresco community version 4.2.e to alfresco community version 5.0.0 having customized code on Windows 7.

I will be using one separate module with custom code to be incorporated into Alfresco 5 war. Subsequently you can use same approach if you have many modules.


Pre-Requisites


There are some prerequisites as well as some standard steps you need to follow, like software requirements, backup strategy etc.
Of course it is been written in alfresco upgrade prerequisites checklist as well.
Some are :

1. Maven 3.x
2. Java 7 +
3. Eclipse


Alfresco 5 Installation


As a first step towards migration, you need to first install a vanilla Alfresco version to which you want to upgrade either intermediate or final.
Make sure you have a clean db and space for fresh installation.
If you want to use SOLR 1.4 with Alfresco 5, you can select the same during installation or else if you are upgrading to SOLR 4 as well, choose SOLR 4.
You can select both options and decide later which one you want to use.

After installation, please do a sanity if everything is looking good. Means you are able to add content and able to search as well.

Development Environment Set Up For War Generation


Refer - http://86anuj.blogspot.com/2017/01/alfresco-development-environment.html for setting up dev environment in eclipse.

Navigate to project folder in command prompt and use below command to generate a vanilla war as well as for maven dependencies to download. Later on we will incorporate custom module/code changes.

mvn install (-DskipTests=true if you want to skip unit tests)

This will generate war under target directory under your project.

Incorporating Custom Code Changes In War 


1. Import your module, if it is separate into same work space where you have your maven alfresco set up.

2. If the changes are in main module, incorporate those changes in main alfresco module (repo) with appropriate folder structure under amp.

3. I am writing steps to incorporate custom code present in a module.

4. In your development environment repo is your main alfresco module. Open it's pom.xml (repo/pom.xml).

5. You will see dependencies and overlay of repo-amp, alfresco-scc by defualt under dependencies tag. If you have any changes under these 2 modules, you can keep it, else comment them out so that you do not have unnecessary modules in your war.

6. Add dependency and overlay of your custom module into repo/pom.xml. Adding sample code below with a custom web script module example :

<!-- If you want to pick module from repository -->

 <dependency>
        <groupId>org.anuj.test</groupId>
        <artifactId>module-alfresco-webscripts</artifactId>
        <version>1.0-SNAPSHOT</version>
        <type>amp</type>
        <scope>system</scope>
        <systemPath>C:\Users\921189.INDIA\.m2\repository\org\anuj\test\module-alfresco-                 
                   webscripts\1.0-SNAPSHOT\module-alfresco-webscripts-1.0-
                   SNAPSHOT.amp</systemPath>
        </dependency>
    </dependencies>

<!-- If you want to pick module pom from local machine -->

 <dependency>
         <groupId>org.anuj.test</groupId>
         <artifactId>module-alfresco-webscripts</artifactId>
         <version>1.0-SNAPSHOT</version>
         <type>amp</type>
         <scope>system</scope>
         <systemPath>C:\Users\<User>\.m2\repository\org\anuj\test\module-alfresco-                 
                   webscripts\1.0-SNAPSHOT\module-alfresco-webscripts-1.0-
                   SNAPSHOT.amp</systemPath>
        </dependency>
    </dependencies>

<!-- Entry under Overlay -->

                            <groupId>org.anuj.test</groupId>
            <artifactId>module-alfresco-webscripts</artifactId>
                            <type>amp</type>
                        </overlay>
                    </overlays>


The above entries in pom will tell maven to add code during build in your repo war.

7. Now go to your custom module. It's pom should mention it's parent as below:

 <parent>
        <groupId>org.anuj.test</groupId>
        <artifactId>alfresco5</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../module-alfresco-main</relativePath> 
    </parent>

8. Build your custom module so that it's amp get's added in repository and local.

Use mvn install (-DskipTests=true if you want to skip unit tests).
In case you want to push to repository use command appropriately.

9. Once build is complete, you will see amp created in maven repository as well as jar created under target.

10. Now build repo pom. You should see it picking up custom module in logs. On successful build, a repo war will be generated under target directory with your custom module code.

11. You can verify your changes in exploded war under target folder.

12. Copy repo.war under tomcat/webapps and rename it to alfresco.

13. Start tomcat.

14. Verify your custom code changes, in my case I verified by hitting webscript url.

15. Once changes looks OK in alfresco war, apply ui related changes in Share module (I will be writing another blog for custom Share changes).

16. If you have done Share changes and testing of your custom functionality looks green, go ahead and point to actual content, indexes and database. Make sure you have back up of all.

17. Start alfresco and check for errors, if any.

18. On successful start, again do a sanity check for functionality.

19. Check alfresco version in System Details as well as in logs.














No comments: