Reputation:
Some times ago, I used Alfresco 5.2 Community Edition. When I needed to develop some kind of customization, I used the Alfresco Maven SDK with three different Maven archetypes, it was:
By using this SDK I developed AMP files that overlaid on either the alfresco.war
or share.war
by using the module management tool.
Now I am using Alfresco 4.2.2 Enterprise Edition and the problem is that all the customizations over the years have been performed directly on the servers in the exploded WAR's.
This approach is described here: Packaging Approaches
Unpackaged Files or ZIP
Many development environments employ a build process that can execute a script to move unpackaged modified files from source control into the web application's exploded WAR file. Ant, bash, or some scripting language can all be good ways to do this ...
Moving unpackaged files has the advantage of being quick and easy to understand ...
And further:
Deployment Locations
One solution is to use a permanently exploded deployment (instead of deploying an Alfresco WAR file under
/webapps
). Create a directory calledalfresco
under the webapps directory and extract the contents ofalfresco.war
into it. Then copy your files to../webapps/alfresco/WEB-INF/
and restart Tomcat ...
Thus, I can't use AMP-customizations(otherwise all previous developments will be deleted). As far as I know, I can use an alternative- JAR-customization.
As described in the same document:
JAR
As of
v3.4
, the Share web application supports overrides that are packaged as JAR files. This allows multiple customizations to be isolated from each other, and order of selection can be predicted. Static files such asJavaScript
,CSS
, or image files that would normally be placed in the web root of the Share application can also be packaged into these JARs ...While it's possible to avoid the overwriting problem (at least in Tomcat) by placing these JAR files in
tomcat/shared/lib
...
However, I can not take advantage of this approach either. For example, I need to override the FreeMarker template:
/opt/tomcat7/webapps/share/WEB-INF/classes/alfresco/web-extension/site-webscripts/components/form/service-note/service-note-order-things.ftl
I create the appropriate directory structure in IDE, change the template in some way, and build the Jar file. Then I put it in tomcat7/shared/lib
(I also placed it in tomcat7/webapps/share/WEB-INF/lib
, but also without success) and restart the application server.
After restarting, I don't see my changes - the template remained the same. Moreover, if I try to add another template to the same directory (.../service-note/...
), a new template there does not appear.
In my Tomcat installation shared classloader is configured properly.
What am I doing wrong? How to override static resources by using JAR?
I would be very grateful for the information. Thanks to all.
Upvotes: 0
Views: 276
Reputation:
It is necessary to use the SurfBug debugging tool to identify the template file (Template Type
property).
Then develop the Spring Surf extension module - "are the preferred way of customizing many of the Alfresco Share user interface features" - and pack it into the Jar. Then I should use the Module deployment which is available through the web- script at:
http://host:port/share/service/modules/deploy
The FTL can be customizing as follows:
@region
;@region
with the new content;@region
completely.In the file system, we will have the same unmodified template, because Spring Surf writes to an in-memory model and then allows extensions to manipulate that model before the model is flushed to the output stream.
See also:
Upvotes: 2