How to add multiple AMP modules to alfresco-sdk? - alfresco

I am new to alfresco-sdk. I am used to have old style AMP modules and then run ant script to combine them into alfresco WAR file.
I have followed tutorials of alfresco-sdk for
alfresco all in one
alfresco AMP
alfresco share
archetypes and it ran successfully.
I could not figure out if I have three different AMP modules, how can I combine them in one?
Say for example, currently I following AMP modules in my repo -
alfresco-DEF-AMP
alfresco-generic-AMP
alresco-ABC-AMP
What should I do such that when I give amp-to-war command, it takes customization from above three modules and puts then into alfresco WAR.

I think you should stick with using a seperate archetype alfresco (AKA repository) AMP for each of your existing modules.
By Running the alfresco SDK maven build with target mvn package on each module, will create an amp file for you. These amps can then be deployed to your alfresco instance (with apply_amps.bat), just like you probably are used to, with ant builds.
You don t have to execute the maven build via run.bat file, which starts alfresco with your module in an embedded container.
If you really want to combine them into one, I suppose you ll have to merge your code of the 3 modules into one module of type alfresco AMP, and still work the above way.

We can use alfresco All-in-one archetype for that.
We can use overlays to include our custom modules such as
alfresco-DEF-AMP
alfresco-generic-AMP
alresco-ABC-AMP
to generate single WAR file (alfresco/repo.war)
Below link is very useful
http://docs.alfresco.com/sdk2.1/concepts/alfresco-sdk-advanced-add-custom-amps.html

Related

Building alfresco.war and share.war using alfresco All-in-one (wars)

I have went through the Alfresco All-In-One sdk steps and I am able to generate the share.war but not able to generate alfresco.war. It shows only the folder structure as shown in above site.
How can I generate alfresco.war?
Whats repo.war?
How to test that the share.war and alfresco.war are properly build?
"Repo" means "repository" and Alfresco is a repository. The WAR that gets created by default matches the directory that project is sitting in, which is called "repo" which is why the WAR is called "repo.war". So "repo.war" can be deployed to your Tomcat server and renamed to "alfresco.war" as they are the same.
You can add your own unit tests to your Alfresco SDK project if you'd like. But there are no standard unit tests that ship with the SDK.
Opinions differ about this, but I would not deploy the WAR files produced by the All-in-One project. Instead, move your AMPs to the server, then use the MMT to install them. That way, you are just testing your local AMPs and you know those work and you have less to move.

Spring + Microservice + JBoss

We are planning to build an application which has multiple modules
(say [Common which contains Admin, Registration], License Module,
Stock Module ). We have planned to use Maven as our build tool
Each module acts like a separate folder(war) where in it has MVC layers in it. Main POM should encapsulate all the modules and form a war file.
If a customer doesn't need License Module, i can just unplug the settings and recreate a war file without much effort.
Now i am struggling to find proper example to build a hierarchy(project structure like above)
Could you please guide me on this ?
You can create a parent project then add the child projects as modules. You can easily comment or delete these modules before building the project.
Here is a basic example.
http://www.concretepage.com/build-tools/maven/parent-pom-child-pom-example
You can get a good idea about parent child maven projects from the following thread as well.
Maven: adding a reference to a parent pom project

Refer custom alfresco content Content Model in maven project

I am using the alfresco repo archetype maven project (alfresco maven SDK 2.1.1) and have a custom alfresco content model defined. In my custom alfresco content model, I need to use/refer an aspect defined in another alfresco content model from a separate amp.
Can anyone please advise what is the correct methodology how achieving the above described?
Note
I can add the custom content model xml file to the maven project and bootstrap it but I am more after a cleaner method keeping in mind module dependency management when doing a release of my amps.
Any help much appreciated.
Regards,
Kavi
In order to have one AMP depend on another you have to use the all-in-one archetype. You can then add the AMPs your project depends on with an overlay, see How to use multiple alfresco AMP file in eclipse

Alfresco Development . Working with All in one Archetype

I have created a multi module project in Alfresco using All-in-one Archetype of the Maven Alfresco SDK. I have selected 1.1.1 archetype version. The project directory was build successfully. But in that directory I couldnt find the wcmqs(Alfresco Web Quick Start) directory which is used to build websites. Can anyone help me hw to get this wcmqs, as I need to work with wcmqs for creating new pages and templetes in wcmqs?
The wcmqs module did used to be in the Maven Alfresco SDK but it never worked very well and caused other problems. It is however unnecessary to use the Maven Alfresco SDK if you wish to get started.
To get started with Alfresco Web Quick Start you just need to download and install the files. You can get the files from Sourceforge: http://sourceforge.net/projects/alfresco/files/Alfresco%204.2.f%20Community/
Installation should be straightforward. You need to install the AMPs on your Alfresco instance and deploy the WARs to a servlet container (like your Tomcat).
If you want to customise Web Quick Start, such as changing the model, that is a different matter. There is a short example here that you can go through to give you an idea of what you need to do:
http://ecmarchitect.com/archives/2011/01/06/1254

Customizing newly created projects in Aptana

I need to define a model for newly created projects in Aptana.
Basically, I want, anytime, when I create a new project, it adds some defined directories/files (not existing files, but new ones) to this project.
I'm not even sure it's possible.
Aptana doesn't appear to support that.
Maybe you can just create a small external sript to do it for you? Not the ideal solution, but better then none.
This might be a longshot, but it is worth mentioning. Since Aptana is based on Eclipse, you might be able to see how Eclipse would handle custom project templates. It appears that the easiest way to go about this is to actually create an Eclipse plugin that has a Template Wizard. IBM has a nice guide on how to use PDE to create a Custom Template. I am not sure if you will be able use PDE from within Aptana (you might be able to), otherwise, you might need to download a stock version of Eclipse, create the Plugin, then install it in Aptana.
Aptana is based on eclipse, so you could use a combination of Maven Archetypes and the Maven eclipse plugin to achieve this really easily.
Download and install maven
Create a basic maven project using the quickstart archetype, Archetypes are project templates used to rubber stamp new project structures. The quickstart is a very basic project template
mvn archetype:generate
generate the eclipse project files using the eclipse plugin. This will create the standard
mvn eclipse:eclipse
tweak the pom until and re-run step 3 until you're satisfied with the layout etc. You'll no doubt have to add configuration the eclipse plugin to add the correct build spec and project nature. If you open an existing .project file it will contain the values you need. you can see here how to add them.
once the project is set up to your liking you can create your own archetype out of it and use this to rubber stamp new projects in the future.
mvn:archetype:create-from-project
now you can run the generate again and can select your archetype from the list. If its not there, you may need to run this first to update the list of archetypes
mvn archetype:crawl
Open Source your archetype for others to use ;)
It's very simple in Studio 3. Try the following: http://wiki.appcelerator.org/display/tis/Creating+a+new+template#Creatinganewtemplate-Creatinganewprojecttemplate
Basically you create a .zip file of the project content, and then write a few lines of Ruby code to reference it.
Aptana uses (as I'm sure you know) its own 'new rails' project that gives you a variety of options.
I don't think it's beyond Will (the RadRails maintainer) to add a simple text field to that Wizard that would allow you to enter a command-line option parameter. He's always been very responsive with my previous bug and feature requests.
If you want to give that a try, and that works, then I would HIGHLY and STRONGLY recommend that you look into one of the new Rails features 'templates' in which you could make a generic template, then call it through the new input box. We use templates at my current job and they save us about 4 hours of work on each project. They are very easy to use...def...definitely.
If you can't wait for the input box, then you could always write the template then call it from within the command line (see
http://m.onkey.org/2008/12/4/rails-templates
for info about templates)
Unless RadRails three is light-years ahead of the latest release, though, you'll be missing out on a lot of very handy advantages of using a more community-supported solution such as VIM or TextMate. (I switched to VIM from RadRails about 4 months ago and have never looked back).
Eclipse has a Plugin Development Environment. If I'm not mistaken, you can also create project templates with it. Please try: http://www.ibm.com/developerworks/library/os-eclipse-pde/

Resources