Maven and alfresco tutorials

47 280 2
Maven and alfresco tutorials

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Maven Mkyong How to install Maven on Windows Posted on November 25, 2009 , Last modified : December 13, 2012 By mkyong Apache Maven is not require to install on Windows as a service component, you just need to download the Maven’s zip file, extract it and configure the Windows environment path variable. Tools Used : 1. JDK 1.6 2. Maven 2.2.1 3. Windows 7 P.S This works with Maven 3 also. 1. JDK and JAVA_HOME Make sure JDK is installed, and “JAVA_HOME” variable is added in Windows environment variable, and point to the JDK folder. 2. Download Apache Maven Visit this Maven official website, choose a version and click on the download link, e.g apache- maven-2.2.1-bin.zip. 3. Extract It Extract the downloaded zip file. In this case, we extracted to d driver and renamed the folder, e.g D:\maven. Note That’s all, just folders and files, installation is NOT required on Windows. 4. Add MAVEN_HOME Add a new MAVEN_HOME variable to the Windows environment, and point it to your Maven folder. 5. Add PATH Update PATH variable, append “Maven bin folder” path, so that you can run the Maven’s command everywhere. 6. Verification Done, to verify it, in command prompt, type “mvn –version“. C:\Documents and Settings\mkyong>mvn -version Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800) Java version: 1.6.0_13 Java home: C:\Program Files\Java\jdk1.6.0_13\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" If you see similar message, means your Apache Maven is installed successfully on Windows. How to enable proxy setting in Maven Posted on November 25, 2009 , Last modified : December 13, 2012 By mkyong There is a high chance your company is set up a firewall and an HTTP proxy server to stop user connects to internet directly. If you are behind a proxy, Maven will fail to download any dependencies. To make it work, you have to declare the proxy server setting in Maven configuration file settings.xml. 1. Maven configuration file Find {M2_HOME}/conf/settings.xml, and put your proxies detail inside. {M2_HOME}/conf/settings.xml <! proxies | This is a list of proxies which can be used on this machine to connect to the network. | Unless otherwise specified (by system property or command-line switch), the first proxy | specification in this list marked as active will be used. | > <proxies> <! proxy | Specification for one proxy, to be used in connecting to the network. | <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>proxyuser</</username> <password>proxypass</password> <host>proxy.host.net</host> <port>80</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> > </proxies> Un-comment the proxy options and fill in your proxy server detail. <! proxies | This is a list of proxies which can be used on this machine to connect to the network. | Unless otherwise specified (by system property or command-line switch), the first proxy | specification in this list marked as active will be used. | > <proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>mkyong</username> <password>password</password> <host>proxy.mkyong.com</host> <port>8888</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> </proxies> 2. Saved it. Done, your Apache Maven should be able to connect to the Internet via your proxy server now. Note Restart is NOT required, how do you restart Maven? Maven is just a command, when you call it, it will read this file again. Cài đăt và thao tác với Maven trên Eclipse IDE [Giới thiệu về Apache Maven] Phần 1: Khái niệm về Maven Đầu tiên là khái niệm về Maven, Maven là gì, nó có lợi ích gì, cái này các bạn "Gúc" một phát ra đầy rẫy mình chỉ tóm tắt chút đỉnh những tài liệu trên "Gúc" để mọi người có thể hình dung cơ bản về Maven. Sau đó mình sẽ tiếp vào phần 2 luôn, tính mình không thích lý thuyết dài dòng. Đối với những Dev nào làm về cách hệ thống lớn, phức tạp sử dụng nhiều thư viện và frame work lại đòi hỏi phải release liên tục cho nên công việc đóng gói (build & deploy), quản lý, nâng cấp và bào trì chúng thực sự rất oải. Ngoài ra việc tích hợp các thư viện mới cũng như quản lý và nâng cấp các thư viện có sẵn là tương đối phức tạp. Tuy nhiên, những trở ngại nói trên hoàn toàn có thể giải quyết được nhờ vào Apache Maven. Vậy ưu điểm của Maven là gì đó là: Tự động hóa toàn bộ quá trình release project, khởi tạo, cập nhật thư viện, build & unit test và release, với một project cỡ lớn thì việc này là tối quan trọng, chỉ cần một sai lầm trong một công đoạn là có để delay cả dự án (lúc đấy thì tha hồ mà OT nhá =)). Quản lý các dependency (các thư viện) trong project một các ưu việt: tự động cập nhật, mở rộng dễ dàng, đóng gói. Vì thế toàn bộ các file jar thư viện điều được "vứt" cho Maven quản lý điều đó khiến cho dung lượng project của chúng ta nhẹ nhàng đi rất nhiều. Phân chia 1 project lớn thành các module nhỏ, từ đó cho phép làm việc đồng thời trên các module khác nhau, đồng thời vẫn tạo được tính thống nhất. Không phụ thuộc vào IDE, cho phép chuyển đổi từ Eclipse sang NetBeans, IntelliJ IDEA một cách dễ dàng. Mình thấy trong thực thế thấy rất nhiều dự án được nhiều công ty cùng phát triển, mỗi công ty lại phát triển một module và lại có một chuẩn IDE riêng nên Maven quả là một lựa chọn không tồi. Trong thực tế thì cũng có khá nhiều dự án cũng như các công ty sử dụng Maven như một nền tảng build với những ứng dụng Java Enterprise. Các Dev, các bạn đã khởi đầu với Ant như là Beginner, vậy hãy đến với Maven như một Professional. Đã được chỉnh sửa lần cuối bởi iamvtn : 17-03-2012 lúc 12:34 AM. In code we trust Trả lời cùng với trích dẫn 1. 17-03-2012, 12:22 AM#2 iamvtn Free as the wind Ngày gia nhập 01 2007 Nơi ở Somewhere I belong Bài viết 169 Cài đặt Maven Apache Phần 2: Cài đặt Maven. 1. Đầu tiên bạn hãy tải Maven tại địa chỉ: maven.apache.org/download.html Ở đây tôi tải bản 3.0.4 là bản mới nhất tại thời điểm tác giả viết bài này. 2. Giải nén rồi để ở đâu đó tùy bạn, ở đây tôi để Maven tại: C:\apache-maven-3.0.4 3. Thiết lập biến môi trường. Bạn hãy vào System Properties chọn Environment Variables. Sau đó chọn New trong mục System variables thiết lập MAVEN_HOME chỉ đến thư mục cài Maven như hình sau. Sau đó ta hãy thêm (edit) patch cho Maven "%M2_HOME%\bin" trong mục Patch trong mục System variables như trong hình: Sau đó ta hãy vào Command line (vào run gõ cmd -> enter) thử lệnh maven version Nếu như trên hình tức là tức là mọi việc đã được cấu hình chính xác. In code we trust Trả lời cùng với trích dẫn 2. 17-03-2012, 12:24 AM#3 iamvtn Free as the wind Ngày gia nhập 01 2007 Nơi ở Somewhere I belong Bài viết 169 Thao tác với Maven trên Eclipse Phần 3: Thao tác với Maven trên Eclipse. Bạn cũng có thể tạo một dự án Maven từ dòng lệnh command line, nhưng ở đây tôi xin phép hướng dẫn thao tác với Maven trên Eclipse. Eclipse mà một IDE tuyệt vời một người bạn không thể thiếu đối với những Java Dev. Đầu tiên bạn phải tải plugin m2eclispe cho Eclipse tại đây: eclipse.org/m2e/download/ Ở đây tôi dùng Eclipse mới nhất là bản Eclipse 3.7 (Indigo). Bạn vào menu Help ấn chọn Install New Software -> điền URL: http://download.eclipse.org/technology/m2e/releases/ hoặc http://download.eclipse.org/technology/m2e/releases-for-indigo/1.4/ Hoặc http://download.eclipse.org/technology/m2e/releases/1.3/1.3.1.20130219- 1424 vào mục work with rồi ấn Add -> Gõ tên plugin rồi ấn OK sẽ hiện thị ra như hình sau: Sau đó việc của bạn là ấn next và chờ plugin cài đặt xong, tranh thủ thư giãn làm cốc caffe cái nhỉ . Khi plugin cài đặt xong bạn hãy restart lại Eclipse, giờ bạn đã có một công cụ tuyệt với để bắt đầu với một dự án Maven đầu tiên. Trước khi tạo project bạn hãy config lại thư viện Maven trong eclipse như sau: chọn menu Window -> Preferences -> Maven -> Installations ấn nút Add rồi chỉ đến thư mục cài đặt Maven rồi ấn OK để Eclipse làm việc với Maven mình vừa cài đặt bên trên. [...]... moment and a fully instantiated, ready-to-run project the next Why should Alfresco developers settle for anything less? With the Alfresco Maven SDK you don't have to The goal of the Maven- based SDK is to make it extremely easy for you to get started with Alfresco development It consists of a project template (an "archetype" in Maven parlance) and some built-in smarts that make Maven understand how... project bằng cách chọn menu File -> Import -> Maven -> Existing Maven Project rồi chọn đến maven project bạn muốn mở là OK Vừa rồi tôi đã hướng dẫn bạn tìm hiểu cơ bản về Maven, đến đây chỉ mới là cào vào bề mặt của maven, Maven đang chờ bạn khám phá và chia sẻ tiếp đó Attached Files o helloworldmaven.rar (41.9 KB, 426 views) Getting Started with the Alfresco Maven SDK Jeff Potts January, 2014  License... Maven understand how to create AMPs and deploy them to Alfresco If you are writing your own custom application that is separate from the Alfresco and Share WARs you don't need the Alfresco Maven SDK But if you intend to write code that runs within either of those web applications, the Alfresco Maven SDK is where you need to start What About the Old Ant-based SDK? Alfresco has provided a downloadable... product such as CMIS, Web Scripts, and advanced workflows using Activiti Aside from its out-of-date examples, the old Ant-based SDK required developers to do too much work With the Alfresco Maven SDK, you don't even have to download anything yourself you just create your project and start coding Now you have a high-level understanding of Apache Maven, AMPs, and the Alfresco Maven SDK It's time to see them... the Alfresco server Once you see: Jan 16, 2014 8:38:20 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] You should be able to go to: http://localhost:8080 /alfresco And log in using "admin" and "admin" When you are done poking around, go back to the window where you ran your Maven command and type ctrl-c to shutdown the server What Just Happened? You asked maven. .. about Maven, Alfresco, or why this SDK exists before jumping in but it kind of helps set the scene, so let me take you through those three concepts quickly Apache Maven Apache Maven is essentially a build management tool It has many features, but the primary time-saving feature is its ability to understand the dependencies your project relies on (and the dependencies of those dependencies and so on) Maven. .. the compiled artifacts that Maven created and start fresh you can run: mvn clean If you also want to delete the embedded database, Alfresco content store, indexes, and log files that were created by running the test Alfresco server, you can run: mvn clean -Ppurge Now you know how to create a new Alfresco project from an archetype and the fundamentals of running builds with and without unit tests Next... USA Introduction This tutorial is for people who have been handed a project that requires you to customize Alfresco in some way and you're thinking, "Now what?" By the end, you'll know:  How to create a new Alfresco project using the Alfresco Maven SDK  What goes where depending on the type of customization you are doing  How to create and run tests  How to produce an artifact suitable for deploying... pom Sau đó click chuột phải vào helloworld project chọn New -> Maven Module cũng tương tự như tạo Maven project bạn chọn Artifact-Id là maven- archetype-quickstart rồi chọn package name ở đây tôi gõ là com.iamvtn .maven. model.domain Sau khi Maven module được tạo ta sẽ có cấu trúc project như sau Khi đó file pom.xml trong parent maven project sẽ thêm vào các module vừa tạo như sau: XML Code: Select... the Alfresco repository tier such as a custom content model, some custom rule actions, a new set of web scripts, or some Activiti business processes It doesn't really matter To create the new project, run this command: mvn archetype:generate -DarchetypeCatalog=https://artifacts .alfresco. com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org .alfresco .maven. archetype: Note : Chạy command . download the Maven s zip file, extract it and configure the Windows environment path variable. Tools Used : 1. JDK 1.6 2. Maven 2.2.1 3. Windows 7 P.S This works with Maven 3 also. 1. JDK and JAVA_HOME Make. installed, and “JAVA_HOME” variable is added in Windows environment variable, and point to the JDK folder. 2. Download Apache Maven Visit this Maven official website, choose a version and click. required on Windows. 4. Add MAVEN_ HOME Add a new MAVEN_ HOME variable to the Windows environment, and point it to your Maven folder. 5. Add PATH Update PATH variable, append Maven bin folder” path,

Ngày đăng: 06/05/2014, 13:54

Mục lục

    Cài đăt và thao tác với Maven trên Eclipse IDE [Giới thiệu về Apache Maven]

     Cài đặt Maven Apache

     Thao tác với Maven trên Eclipse

     các thành phần trong Maven project

     Làm việc với nhiều module với Maven

    Getting Started with the Alfresco Maven SDK

    Alfresco Module Package (AMP)

    What About the Old Ant-based SDK?

    Let's Run It

    Other Commands for Invoking the Build

Tài liệu cùng người dùng

Tài liệu liên quan