AnsweredAssumed Answered

How to properly specify source and target packages for Spring Surf Class Loader?

Question asked by Aleksey Bykov on Dec 5, 2017
Latest reply on May 13, 2018 by Aleksey Bykov

I am using Alfresco 4.2.2 Enterprise Edition and using Jar files to make customizations.

 

I can customize the My Tasks dashlet, for example. The source files that I want to customize are located in the path:

 

\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\workflow\ 

 

To customize the dashlet, I create the following directory structure:

 

C:\Users\bykov_an>tree C:\EclipseWorkspaces\alfresco\my-tasks-customization-example /F

C:\ECLIPSEWORKSPACES\ALFRESCO\MY-TASKS-CUSTOMIZATION-EXAMPLE
│   .classpath
│   .project
│   build.xml

├───.settings
│       org.eclipse.jdt.core.prefs

├───bin
├───build
│   └───lib
│           my-task-customization-example.jar

└───config
    ├───alfresco
    │   ├───site-data
    │   │   └───extensions
    │   │           my-tasks-customisation.xml
    │   │
    │   └───site-webscripts
    │       └───mytasks
    │           └───customization
    │                   task-list.get.html.ftl
    │                   task-list.get.properties
    │
    └───META-INF
        └───components
            └───workflow
                    task-list-custom.js

 

my-tasks-customisation.xml:

 

<extension>
   <modules>
      <module>
         <id>My Tasks customization</id>
         <auto-deploy>true</auto-deploy>
         <version>1.0</version>
         <customizations>
            <customization>
               <targetPackageRoot>org.alfresco.components.workflow</targetPackageRoot>
               <sourcePackageRoot>mytasks.customization</sourcePackageRoot>
           </customization>
         </customizations>
      </module>
   </modules>
</extension>

 

task-list.get.html.ftl:

 

<@markup id="additional-content" target="js" action="replace" scope="global">
   <@script src="${url.context}/res/components/workflow/workflow-actions.js" group="workflow"/>
   <@script src="${url.context}/res/components/workflow/task-list-custom.js" />
</@>

 

Etc.

 

Ant script that I use:

 

<?xml version="1.0" encoding="UTF-8"?>
<project default="deploy-jar">

     <property name="jar.name" value="my-task-customization-example.jar"/>    
     <property name="jar.deploy.dir" value="C:\alfresco\customizations"/>

     <property name="project.dir" value="."/>
     <property name="build.dir" value="${project.dir}/build"/>
     <property name="jar.file" value="${build.dir}/lib/${jar.name}"/>

     <target name="mkdirs">
          <mkdir dir="${build.dir}/lib" />
     </target>
    
     <target name="package-jar" depends="mkdirs">
          <jar destfile="${jar.file}" >
               <fileset dir="${project.dir}/config" includes="**/*" />
          </jar>
     </target>
    
     <target name="deploy-jar" depends="package-jar">
          <copy file="${jar.file}" todir="${jar.deploy.dir}"/>
     </target>
    
     <target name="clean">
          <delete file="${jar.file}"/>
          <delete file="${jar.deploy.dir}/${jar.name}"/>
     </target>

</project>

 

It all works perfectly: I placed my-task-customization-example.jar in \share\WEB-INF\lib, then reboot the server and see the changes that I made.

 

The problem is that I need to customize one of the FreeMarker templates, that is placed in the following path:

 

/share/WEB-INF/classes/alfresco/web-extension/site-webscripts/components/form/service-note/service-note-order-things.ftl

 

Ie first in the directory web-extension, then in the directory site-webscripts. I created a similar directory structure, in several variations - but I didn't achieve the effect, I can't customize this template...

 

I can place the extension config file in /alfresco/site-data/extensions or in /alfresco/web-extension/site-data/extensions/ and in both cases it pick up successfully.

 

What am I doing wrong? How to customize FreeMarker template located in /web-extension/site-webscripts/ folder?

 

I would be very grateful for the information. Thanks to all.

Outcomes