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
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
mvn archetype:generate -DarchetypeCatalog=http://artifacts.alfresco.com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org.alfresco.maven.archetype:
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 below 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 with custom code.
a. Open command prompt.
b. Navigate to project you want to build and generate war.
c. Type mvn package.
d. Wait for sometime, a war will be generated in project target folder.
e. You can copy generated war under tomcat instance.
11. Some more useful maven commands for alfresco
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).
You can follow below steps for setting up development environment in eclipse.
# Pre Requisite
1. Maven 3.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
mvn archetype:generate -DarchetypeCatalog=http://artifacts.alfresco.com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org.alfresco.maven.archetype:
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 below 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 with custom code.
a. Open command prompt.
b. Navigate to project you want to build and generate war.
c. Type mvn package.
d. Wait for sometime, a war will be generated in project target folder.
e. You can copy generated war under tomcat instance.
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) |
mvn clean -Ppurge | Removes DB, alf_data,
indexes and log files. Useful to purge the development repo (by default self contained in ${project.basedir}/alf_data_dev. |
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