With the recent developments in Alfresco SDK since Alfresco 4.2 community version they have mavenized complete SDK and ANT is no longer being used. So, now all our repository and share related alfresco projects will also be managed by maven. During development we often needs to look in to the source of alfresco to get idea on various APIs of Alfresco hence it is required to set dependency properly and attach source to those alfresco dependency jar files.
Ways to attach source and Java Doc for maven based project.
Download and attach
If you search for this you will get to know about few ways provided by eclipse maven plugin which allow us to download that dependencies and source.
Different Options
Through POM.xml entry
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <configuration> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </configuration> </plugin> </plgins> </build>
Through Setting.xml entry of maven
<profiles> <profile> <id>sources-and-javadocs</id> <properties> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </properties> </profile> </profiles>
Through these commands
mvn eclipse:eclipse-DdownloadJavadocs=true
or
mvn eclipse:eclipse-DdownloadSources-DdownloadJavadocs
You can directly select option from Eclipse as well as follow.
How to use Downloaded Alfresco SDK Source
- Download and Extract SDK in particular folder within your file system
- Right click on jar> Properties>Java Source Attachment
- You will see variable and extension options there
- Create New Variable SDK_PATH and point to src folder which you will find under the folder where you have extracted your SDK source.
Ex.
C:\Alfresco\setupFiles\alfresco-community-sdk-4.2.f\src
- Your Then in extension you need to select particular jar file source
You will be able to see source of all services and alfresco classes. This is very useful for developers which are new to maven and used to of ANT developments.