Alfresco provides archetype for quick set up of development environment.You can follow below steps for setting up development environment in eclipse.
# Pre Requisite
1. Maven 3.x and 2.x
2. Java 7 +
3. Eclipse
1. Create a folder.
2. Open command prompt.
3. Navigate to folder you have created.
4. Generate a maven project (archeType) using below command with Maven 2.1 as 3.x doesn't generate interactive mode. You can set Maven 3.x in path again after archetype generation.
mvn archetype:generate -Dfilter=org.alfresco:
this will generate interactive mode and you will get options to download sdk's depending on your requirement.
5. Select all in one option . This will download all sdk's/projects (alfresco, share etc). You can work independently on them.
6. Now select archetype version, this is aligned to alfresco build versions.
You can verify alfresco versions against sdk's here.
7. Provide group id (kind of package name), artifact id (project name) and version (set this to default, unless you know about any specific version)
8. Now you will see folders generated with pom's. These are alfresco projects for development.
9. For adding these projects into eclipse follow belo steps.
a. Open eclipse workspace.
b. In project explorer, right click and select import.
c. Select existing maven project.
d. Navigate to folder you had created above.
e. Select all alfresco downloaded projects and import them.
f. Your projects are ready for development.
10. Building project and generating war
a. Open command prompt.
b. Navigate to project (repo/share).
c. Type mvn package.
d. Wait for sometime, a war will be generated under target folder.
e. You can copy generated war under tomcat instance by renaming from repo to alfresco.
11. Some more useful maven commands for alfresco
Command Description
mvn package Runs unit tests and packages AMP in ${project.build.directory} /${project.build.finalName}.amp
mvn install Like mvn package but also installs AMP in local Maven repository
to be depended upon
mvn test Runs unit tests
mvn install -DskipTests=true Like mvn install but skips unit tests
mvn install -Prun Like mvn install but also triggers the runner project to run
Alfresco, Share, Solr and Web Quick Start in Tomcat (with H2 embedded database)
Note:
This is an important command to use if you change significant settings in your project - for example you change the Alfresco edition from Community to Enterprise. It is important to purge databases and other
data that might otherwise be persisted.
mvn install -Pamp-to-war,rad Similar to mvn install -Pamp-to-war but also adds support for remote
JUnit running and for hot reloading with JRebel (requires appropriate MAVEN_OPTS configuration).
No comments:
Post a Comment