| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <html> |
| <head> |
| <script type="text/javascript">var xookiConfig = {level: 1};</script> |
| <script type="text/javascript" src="../xooki/xooki.js"></script> |
| </head> |
| <body> |
| <textarea id="xooki-source"> |
| If you want to use a maven pom.xml instead of ivy.xml file, you just have to select a pom file in the configuration form of IvyDE class path. |
| When a maven pom is selected, the configurations list is updated with all maven scopes. |
| |
| Both examples below are a good illustration of maven pom use simplicity : |
| <ul> |
| <li><a href="#one">Maven1 sample</a></li> |
| <li><a href="#two">Maven2 sample</a></li> |
| </ul> |
| <h1><a name="one"></a>Maven1 Sample</h1> |
| |
| This sample presents a simple use case of maven pom for IvyDE class path container. We are going to create an eclipse project on commons-httpclient sources. |
| |
| <b> - Download the <a href="http://archive.apache.org/dist/httpcomponents/commons-httpclient/3.0/source/commons-httpclient-3.0-src.zip">commons httpclient sources</a></b> |
| |
| <b> - Unzip this file (c:/tmp/commons-httpclient/)</b> |
| |
| <b> - Create a new Eclipse java project based on the unzipped sources (c:/tmp/commons-httpclient/)</b> |
| |
| <center> |
| <img src="../images/httpProject_errors.jpg"><br /> |
| <u><b>Notes:</b></u> your project do not compile: some imports cannot be resolved. |
| |
| </center> |
| |
| <b> - Add a new class path container based on the "project.xml" pom and select "default" configuration (maven scope)</b> |
| |
| <center> |
| <img src="../images/httpProject_pom.jpg"> |
| </center> |
| |
| |
| <b> - That's all : your project compiles !</b> |
| |
| <center> |
| <img src="../images/httpProject_clean.jpg"> |
| </center> |
| |
| |
| <h1><a name="two"></a>Maven2 Sample</h1> |
| |
| This sample shows that IvyDE Class path container on a Maven2 pom can handle transitive dependancies. |
| |
| <b> - Create a new empty java project in eclipse.</b> |
| |
| <b> - In your project, create an <tt>ivysettings.xml</tt> file: </b> |
| |
| <code><ivysettings> |
| <conf defaultResolver="ibiblio"/> |
| <resolvers> |
| <ibiblio name="ibiblio" /> |
| </resolvers> |
| </ivysettings> |
| </code> |
| |
| Using the m2compatible attribute, you can benefit from Maven2 repository compatibility. |
| |
| <b> - In your project, create a <tt>pom.xml</tt> file: </b> |
| |
| <code> |
| <project> |
| <modelVersion>4.0.0</modelVersion> |
| <groupId>com.mycompany</groupId> |
| <artifactId>myproject</artifactId> |
| <version>1.0-SNAPSHOT</version> |
| <dependencies> |
| <dependency> |
| <groupId>commons-httpclient</groupId> |
| <artifactId>commons-httpclient</artifactId> |
| <version>3.0</version> |
| </dependency> |
| </dependencies> |
| </project> |
| </code> |
| |
| <b> - On the pom.xml file, open the context menu and click on "Add Ivy Library...":</b> |
| |
| <ul> |
| <li>Select "Enable project specific settings" and set the "Ivy setting path" to: <tt>project:///ivysettings.xml</tt> </li> |
| <li>Select the configuration <tt>compile</tt> and <tt>runtime</tt></li> |
| </ul> |
| |
| <center> |
| <img src="../images/maven2classpath1.jpg"/> |
| </center> |
| |
| <b> - That's all ! Your IvyDE class path container gets all dependencies even those that were transitive to the commons-httpclient module !</b> |
| |
| <center> |
| <img src="../images/maven2classpath2.jpg"/> |
| </center> |
| </textarea> |
| <script type="text/javascript">xooki.postProcess();</script> |
| </body> |
| </html> |