The Alfresco SDK, based on Maven, provides a simple way to create a fresh Surf project that you can work with and extend.
In the terminal run the following command:
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/archetype-catalog.xml
- Choose the Surf project archetype (spring-surf-archetype).
- When prompted for groupId enter com.alfresco.tutorials, or other suitable package name you would prefer.
- When prompted for artifactId enter a suitable project name such as simple-surf-project.
- If prompted for a packageId accept the default.
- The project will be created.
- Change into the directory created for you based on the artifactId. In this case it will be simple-surf-project.
You can now build the project with the following command:
You can now run the project with the following command:
- Once the server has booted up you can point your web browser at http://localhost:8080/ to see the Surf web site.
- You can type a URL such as the following to further test the web site: http://localhost:8080/page/home/welcome/tony
You can now explore the project more conveniently by importing the project into an IDE such as Eclipse.
- In Eclipse, select File, Import, and then select Existing Maven Project.
- Browse to the simple-surf-project directory.
Click Finish to import the project into Eclipse.
Now that the project is imported into Eclipse, you can use the Package Explorer to explore the directory hierarchy and files. Note that all the basic configuration files you need are present and heavily commented. You can use this project as the starting point for your own projects.