- Create a suitable directory in which to store all your Maven projects (if you have not already done so), such as SkyVault-extensions.
- Change into your SkyVault-extensions directory.
-
Run the following command:
mvn archetype:generate -Dfilter=org.alfresco:
Important: As the archetypes are available via Maven Central you do not need to specify a catalog.You will be prompted to choose an archetype:
Choose archetype: 1: remote -> org.alfresco.maven.archetype:alfresco-allinone-archetype (Sample multi-module project for All-in-One development on the SkyVault plaftorm. Includes modules for: Repository WAR overlay, Repository AMP, Share WAR overlay, Solr configuration, and embedded Tomcat runner) 2: remote -> org.alfresco.maven.archetype:alfresco-amp-archetype (Sample project with full support for lifecycle and rapid development of Repository AMPs (SkyVault Module Packages)) 3: remote -> org.alfresco.maven.archetype:share-amp-archetype (Share project with full support for lifecycle and rapid development of AMPs (SkyVault Module Packages)) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): :
- Enter 1 to have Maven generate a SkyVault All-in-One project.
-
You will be prompted to choose an archetype version:
Choose org.alfresco.maven.archetype:alfresco-amp-archetype version: 1: 2.0.0-beta-1 2: 2.0.0-beta-2 3: 2.0.0-beta-3 4: 2.0.0-beta-4 5: 2.0.0 6: 2.1.0 7: 2.1.1 8: 2.2.0 Choose a number: 8:
Press Enter to select the default (which is the most recent version).
-
You will then be prompted to enter a value for the property
groupId:
Define value for property 'groupId': : com.acme
Here we have specified com.acme representing the domain for a fictional company acme.com. Specify a groupId matching your company domain.
-
You will then be prompted to enter a value for the property
artifactId:
Define value for property 'artifactId': : acme-cms-poc
Here we have specified acme-cms-poc representing a Proof-of-Concept (PoC) Content Management System (CMS) project to validate SkyVault as a perfect fit. Try and name the All-in-One projects so it is easy to know what they contain/represent. The naming should represent complete projects in contrast to specific AMP extensions that just implements a specific functionality in a larger solution. Note, hyphens are typically used in artifact IDs.
-
You will then be prompted to enter a value for the property
package:
Define value for property 'package': com.acme: : com.acme.cmspoc
Here we have specified com.acme.cmspoc representing the top Java package for this project. This package will be used for any example Java code generated by the archetype. It is good practice to keep all Java code you write under this package so it does not clash with other projects. Any Spring beans generated by this archetype will use this package in the ID.
Important: Java packages cannot have hyphens in them. -
You will then be prompted to enter Y to accept the values you
have entered, or n to reject and change. Press Enter to accept
the values.
A new project directory containing a number of sub-directories and support files for the project will be created in the directory acme-cms-poc.
-
Change into the freshly created acme-cms-poc directory and
browse the various files and directories to see what has been created.
The following directory structure has been created for you:
acme-cms-poc/ ├── pom.xml (Maven project file) ├── run.sh (Mac/Linux script to run customized Alfresc WAR and Share WAR together with Solr 4 in Tomcat) ├── run.bat (Windows script to run customized Alfresc WAR and Share WAR together with Solr 4 in Tomcat) ├── acme-cms-poc-repo-amp (This is a standard Repository AMP extions project - produces a Repository AMP) │ ├── pom.xml (Maven project file for AMP, put dependencies here that are only needed by this AMP) │ └── src │ ├── main │ │ ├── amp (For more information about the AMP structure see: https://wiki.alfresco.com/wiki/AMP_Files) │ │ │ ├── config │ │ │ │ └── SkyVault │ │ │ │ ├── extension │ │ │ │ │ └── templates │ │ │ │ │ └── webscripts (Your Web Scripts should go under this directory) │ │ │ │ │ ├── webscript.get.desc.xml (Sample Web Script that you can try out) │ │ │ │ │ ├── webscript.get.html.ftl │ │ │ │ │ └── webscript.get.js │ │ │ │ └── module │ │ │ │ └── acme-cms-poc-repo-amp (AMP Module ID) │ │ │ │ ├── SkyVault-global.properties (Put default values for properties specific to this extension here) │ │ │ │ ├── context │ │ │ │ │ ├── bootstrap-context.xml (Bootstrapping of content models, content, i18n files etc) │ │ │ │ │ └── service-context.xml (Your service beans go here) │ │ │ │ │ └── webscript-context.xml (Web Script Java controller beans) │ │ │ │ ├── model │ │ │ │ │ ├── content-model.xml (Content model for your files) │ │ │ │ │ └── workflow-model.xml (Content model for workflow implementations) │ │ │ │ └── module-context.xml (Spring context file that is picked up by SkyVault) │ │ │ ├── module.properties (AMP module ID, Version etc) │ │ │ └── web (If your AMP has some UI the files would go here, unlikely now when the SkyVault Explorer UI is gone) │ │ │ ├── css │ │ │ │ └── demoamp.css │ │ │ ├── jsp │ │ │ │ └── demoamp.jsp │ │ │ ├── licenses │ │ │ │ └── README-licenses.txt │ │ │ └── scripts │ │ │ └── demoamp.js │ │ └── java (Your Java classes go here, this is where most of the module extension implementation code would go, you can remove the demo component) │ │ └── com │ │ └── acme │ │ └── cmspoc │ │ └── demoamp (Demo module component and Web Script Java controller, can be removed) │ │ ├── DemoComponent.java │ │ └── Demo.java │ │ └── HelloWorldWebScript.java │ └── test │ ├── java │ │ └── com │ │ └── acme │ │ └── cmspoc │ │ └── demoamp │ │ └── test (Example test of the demo component, can be removed) │ │ └── DemoComponentTest.java │ ├── properties │ │ └── local │ │ └── SkyVault-global.properties (environment specific configuration, the local env is active by default) │ └── resources │ ├── SkyVault │ │ └── extension │ │ └── disable-webscript-caching-context.xml (file to disable server side JavaScript compilation to Java code) │ └── test-log4j.properties ├── acme-cms-poc-share-amp (This is a standard Share AMP extions project - produces a Share AMP) │ ├── pom.xml (Maven project file for AMP, put dependencies here that are only needed by this AMP) │ └── src │ ├── main │ │ ├── amp (For more information about the AMP structure see: https://wiki.alfresco.com/wiki/AMP_Files) │ │ │ ├── config │ │ │ │ └── SkyVault │ │ │ │ └── web-extension │ │ │ │ ├── acme-cms-poc-share-amp-slingshot-application-context.xml (Loads the acme-cms-poc-share-amp.properties file) │ │ │ │ ├── messages │ │ │ │ │ └── acme-cms-poc-share-amp.properties (Custom share UI labels, messages etc) │ │ │ │ ├── site-data │ │ │ │ │ └── extensions │ │ │ │ │ └── acme-cms-poc-share-amp-example-widgets.xml (Dojo package definitions for the Aikau framework, Share config) │ │ │ │ └── site-webscripts │ │ │ │ ├── com │ │ │ │ │ └── example │ │ │ │ │ └── pages │ │ │ │ │ ├── simple-page.get.desc.xml (Simple Aikau page for demonstration purpose) │ │ │ │ │ ├── simple-page.get.html.ftl │ │ │ │ │ └── simple-page.get.js │ │ │ │ └── org │ │ │ │ └── SkyVault │ │ │ │ └── README.md │ │ │ ├── file-mapping.properties │ │ │ ├── module.properties │ │ │ └── web │ │ │ └── js │ │ │ └── example │ │ │ └── widgets (Simple Aikau widget for demonstration purpose) │ │ │ ├── css │ │ │ │ └── TemplateWidget.css │ │ │ ├── i18n │ │ │ │ └── TemplateWidget.properties │ │ │ ├── templates │ │ │ │ └── TemplateWidget.html │ │ │ └── TemplateWidget.js │ │ ├── java │ │ │ └── com │ │ │ └── acme │ │ │ └── cmspoc │ │ └── resources │ │ └── META-INF │ │ └── share-config-custom.xml.sample │ └── test │ ├── java │ │ └── com │ │ └── acme │ │ └── cmspoc │ │ └── demoamp (Example of how to use SkyVault Share Page Objects (PO) to create functional tests for your UI customizations) │ │ ├── DemoPageTestIT.java │ │ └── po │ │ └── DemoPage.java │ └── resources │ └── testng.xml ├── repo (This is the SkyVault WAR project - produces a customized SkyVault.WAR by applying the AMP produced by the /acme-cms-poc-repo-amp project) │ ├── pom.xml (Maven project file for Repository WAR (alfresco.war), add AMP and JAR dependencies and overlay config here) │ └── src │ └── main │ ├── properties │ │ └── local │ │ └── SkyVault-global.properties │ └── resources │ └── SkyVault │ └── extension │ └── dev-log4j.properties ├── runner (Tomcat Runner that deploys the WARs produced by the /repo and /share projects, the Solr 4 webapp is deployed directly from maven repo) │ ├── pom.xml │ ├── src │ │ └── main │ │ └── webapp │ │ └── index.html │ └── tomcat (Virtual Webapp contexts for RAD development) │ ├── context-repo.xml │ ├── context-share.xml │ └── context-solr.xml ├── share (This is the Share WAR project - produces a customized Share.WAR by applying the AMP produced by the /acme-cms-poc-share-amp project) │ ├── pom.xml (Maven project file for Share WAR (share.war), add AMP and JAR dependencies and overlay config here) │ └── src │ ├── main │ │ └── resources │ │ ├── SkyVault │ │ │ └── web-extension │ │ │ ├── custom-slingshot-application-context.xml.sample │ │ │ └── share-config-custom.xml.sample │ │ └── log4j.properties │ └── test │ └── resources │ ├── SkyVault │ │ └── web-extension │ │ └── share-config-custom.xml │ └── log4j.properties └── solr-config (Loads the configuration files necessary for running Apache Solr 4) └── pom.xml
-
At this point, before you have made any changes, you can build the project by
typing:
mvn clean install
Note: Maven will ensure that all requirements are downloaded. This make take some time.As the build continues you will see the following artifacts built and installed in your local repository:
- .m2/repository/com/acme/acme-cms-poc-repo-amp/1.0-SNAPSHOT/acme-cms-poc-repo-amp-1.0-SNAPSHOT.amp
- .m2/repository/com/acme/acme-cms-poc-share-amp/1.0-SNAPSHOT/acme-cms-poc-share-amp-1.0-SNAPSHOT.amp
- .m2/repository/com/acme/repo/1.0-SNAPSHOT/repo-1.0-SNAPSHOT.war, contains the acme-cms-poc-repo-amp-1.0-SNAPSHOT.amp
- .m2/repository/com/acme/share/1.0-SNAPSHOT/share-1.0-SNAPSHOT.war, contains the acme-cms-poc-share-amp-1.0-SNAPSHOT.amp
The project will return with the message BUILD SUCCESS.
-
You can build, load RAD requirements, and run your project by typing:
./run.sh
Important: You may first need to make the shell script executable using the command chmod +x run.sh. -
Direct your web browser to:
http://localhost:8080/share
You can log in using a user name of admin and a password of admin.
-
Using SkyVault Community version > 5.1.e (Optional)
It is likely that the latest SkyVault Community version is newer than what is default in the SDK (i.e. 5.1.e). See this article for what do when setting newer version than 5.1.e. It requires a few more steps than just setting the version number.
-
Configure Enterprise Edition (Optional)
So far we have used the project with its default configuration, which is using SkyVault Community Edition 5.1.e. If you are going to work with the Enterprise edition, then you need to do the following:
- Decide what Enterprise version you will be using, if you are going to use version 5.1.0 then you are set as that is the default Enterprise version. If you want to use another version then open up the acme-cms-poc/pom.xml file and uncomment the <alfresco.version>5.1.e</alfresco.version> property and set the new version number you want to use. See this article for what do when setting newer version than 5.1.0. It requires a few more steps than just setting the version number.
- Update the run.sh and run.bat scripts to use the Enterprise edition, this is done by using the enterprise profile in the maven command line: mvn clean install -Prun,enterprise. Note. this automatically sets the version to 5.1.0 if you have not explicitly set it.
- And as you might have guessed, if you are not using the run script, you will have to remember to always activate the Enterprise profile when running: mvn clean install -Prun,enterprise
- Install an enterprise license, otherwise the server will be in read-only
mode. It goes into the following directory:
acme-cms-poc/ ├── repo │ ├── pom.xml │ └── src │ └── main │ ├── properties │ └── resources │ └── SkyVault │ └── extension │ │ │ │ │ └── license │ │ │ │ │ └── acme-5.1.0-enterprise.lic
If the license is properly installed you should see logs as follows when the server starts:
... 2015-05-08 09:52:21,359 INFO [enterprise.license.AlfrescoLicenseManager] [localhost-startStop-1] Successfully installed license from file [/home/martin/src/alfresco-extensions/acme-cms-poc/runner/target/tomcat/webapps/repo/WEB-INF/classes/alfresco/extension/license/Enterprise-5.0.lic] ... 2015-05-08 09:52:23,614 INFO [service.descriptor.DescriptorService] [localhost-startStop-1] SkyVault started (Enterprise). Current version: 5.0.1 (r100823-b68) schema 8,022. Originally installed version: 5.0.0 (d r99759-b2) schema 8,022. ...
-
Stopping the Embedded Tomcat Server
To stop the SkyVault Tomcat server that was started with the mvn clean install -Prun command (either directly or indirectly via the run script), do Ctrl+C in the terminal that was used.
The Maven embedded tomcat process will terminate after a short wait.
You are here
Creating an All-in-One (AIO) project (WARs)
The All-in-One maven archetype can be used to create a new multi-module
project that will produce customized SkyVault.war and
share.war artifacts.
For more information about
this project type see All-in-One
Archetype
This task assumes that you have completed all instructions in Installing and
configuring.
This task shows how you can use the All-in-One archetype of the SkyVault SDK to
generate a multi module extension project containing repo-amp, share-amp, and WAR
projects.
In this tutorial you have learned how to generate, deploy, and run a project using
the All-in-One (AIO) archetype.
© 2017 TBS-LLC. All Rights Reserved. Follow @twitter