Xem mẫu

Installation and Configuration 4. The project named wcmbook will be created with a src folder and the JRE library with the required .jar files attached for this project (if JDK is already installed on your machine). You can check that in the Package Explorer window as shown in the following screenshot: Configuring the build path Now you need to configure the build path so that when you create any Java files, it can automatically be compiled by Eclipse. For that, make sure the Project | Build Automatically option is checked. To configure the build path for the project, follow these steps: 1. Right-click on project name, that is, wcmbook and select Build Path | Add Libraries. 2. Select User Library and click on Next. 3. Click on the User Libraries button. In the User Libraries screen, click on the New button. 4. Provide the name of the library as alfresco_lib and click on OK. 5. Select that library name and click on Add JARs. Select all the .jar files from the Alfresco installed folder, tomcat/lib, and add those to this library. Also select all the .jar files from the tomcat/webapps/alfresco/WEB-INF/lib folder and add those to this library. Once done, click on OK. 6. Then click on Finish. [ 32 ] Download from Wow! eBook Chapter 2 Source code tree Create the following folder structure for the project to store different types of files: • src ° • config ° alfresco • extension • • messages • • web ° jsp ° css ° scripts ° images ° … • /src: Put all your source Java classes in this folder with respective package structure. • /config/alfresco/extension: Place all your extension configuration files in this folder. • /config/alfresco/messages: Put Resource Bundle files (properties file) in this folder. • /web/jsp: Place any custom or modified JSPs in this folder. It`s a best practice to create an extension folder inside the jsp folder and put all the custom JSPs in that folder. • /web/css: Place any custom or modified CSS files in this folder. It`s a best practice to create an extension folder inside the css folder and put all the custom CSS files in that folder. • /web/images: Place any images that you have modified or newly created in this folder. • /web/scripts: Place any custom JavaScript files used by the user interface in this folder. [ 33 ] Download from Wow! eBook Installation and Configuration To create a folder in the Eclipse project: 1. Select the web project for root-level folder or select the parent-level folder and right-click, then click on New | Folder. 2. Provide the folder name and click on Finish. To create a package in the eclipse project: 1. Select the source folder src, right-click, select New | Package. 2. In Name, provide the name of package, that is, com.Cignex.web.bean, and so on. Once you are done with the package and folder structure creation, it will look similar to the following screenshot: [ 34 ] Download from Wow! eBook Chapter 2 Build process We will use Apache Ant, which is a Java-based build tool, for building the application from Eclipse. Why to use a build tool There are a number of steps required to transform the source into a deployable software solution. In general, a build tool allows developers and build managers to describe the build process. In a build, some steps may need to be executed before others or they may be independent of others. In summary, a build tool provides a mechanism to describe the operations and structure of the build process to deploy the code. Integrating Ant with Eclipse As we are using Eclipse as our development environment, we will learn how we can integrate Ant with Eclipse for the build process. First we need to create a new build file in Eclipse. Creating the build.xml file: 1. Right-click on project name wcmbook in Package Explorer 2. Select New | File 3. In the File Name box, type build.xml 4. Click on Finish Enter the targets for Ant Build in this file and save it. You can have build targets for compiling the code, packaging the .jar file, and so on. The build file we will use for our examples throughout the book will look like: [ 35 ] Download from Wow! eBook Installation and Configuration Installing Cignex AMP into WAR [ 36 ] Download from Wow! eBook ... - tailieumienphi.vn