Alfresco SDK Development on Mac
As a leading Alfresco partner, we receive a lot of questions on best practices for implementation and usage of the platform. This is another part of our series entitled Common Questions. In this installment, we look at a question we received about tips and tricks for speeding up Alfresco SDK development for those using a Mac. If you have any questions, feel free to contact us today.
Question:
I use a Mac, do you have any tips or tricks to improve the speed of SDK development?
Answer:
If you are using the Alfresco SDK on a Mac, we hope you will experience some productivity improvements from the following tips:
1. Add your .local hostname to /etc/hosts
If you look in the default /etc/hosts
file, you will find the following two standard lines:
127.0.0.1 localhost
::1 localhost
It turns out, there is an issue with hostname resolution in Java on Macs. This can be worked around by adding your hostname entry to this file. In order to find you hostname, run the hostname
command.
For example, when I run this command I get the following output:
Rufuss-MacBook-Pro.local
Here is what mine looks like now after I updated it:
127.0.0.1 localhost Rufuss-MacBook-Pro.local
::1 localhost Rufuss-MacBook-Pro.local
This improves startup for a vanilla SDK 2.2.0 project on my laptop from three minutes and 40 seconds to two minutes and 40 seconds.
2. Stop spotlight from scanning your SDK project
We have seen cases where having spotlight scanning our SDK projects causes excessive speed decreases during startup and runtime. Unlike the previous tip, this one is hard to provide concrete evidence for. Suffice it to say, performance is more consistent if you perform this action.
Open System Preferences, select the spotlight “app” and then the privacy tab. Click the + button near the bottom of the window and add your project directory. Because I have many SDK projects all under one parent directory, I exclude the parent so all of my SDK projects benefit from this trick.
3. When doing repo development turn of Share developer mode
If you are focusing on repository/platform development and don’t need Share to perform automatic reloading of configuration and other files—but you do use Share to test things out—edit share/src/test/resources/alfresco/web-extension/share-config-custom.xml
for SDK 2.2.0 and below or
src/test/resources/share/share-config-custom.xml
for SDK 3.0 and above. Change:
true
to
false
Initial page loads in Share will still be pretty slow as assets are cached. For me, being set to true
meant most pages load in four to eight seconds. Changing the value to false
means initial page loads are about the same, although some are faster. If I go back to a page that has already been cached, the page will often load in less than one second.
I hope this will be of value to those using Macs. If you have additional questions on this topic or something new, don’t hesitate to contact us.