blob: 6a5dde2081295b5b12340f43d53d7a7e94062061 [file] [log] [blame]
<!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>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<script type="text/javascript">var xookiConfig = {level: 0};</script>
<script type="text/javascript" src="xooki/xooki.js"></script>
</head>
<body>
<textarea id="xooki-source">
Ivy is a generic dependency manager and can manipulate jars as well as any other kind of resources. IvyDE leverages this feature by bringing dependency management to non Java Eclipse projects.
In this document we will document how to work with IvyDE and non Java dependencies with a concrete exemple: we will manage the dependencies between some javascript files and bring them into a Java webapp.
<h1>Import the sample project into Eclipse</h1>
The full project sample can be downloaded from <a href="sample/webapp-js-repo.zip">there</a>. Unzip it somewhere and import it into Eclipse (see "Existing Projects into Workspace" in the "Import" menu).
The Eclipse project is already configured with an IvyDE classpath container so we can run the Java webapp. We will just have to add the retrieve of the javascript files.
<h1><a name="configure"></a>Configure the non-Java dependencies</h1>
<h2><a name="configure-nature"></a>Configure the Ivy nature</h2>
In order to manage dependencies with Ivy, it is required for the Eclipse project to have the "Ivy" nature.
In the sample project, an Ivyde classpath container is already configured, so the Eclipse project already has the "Ivy" nature.
In case your project doesn't has it, right click on the project and in the menu "Configure" select "Add Ivy dependency management".
<center><img src="images/add_ivy_nature.jpg"/></center>
<h2><a name="configure-retrieve"></a>Add a retrieve setup</h2>
Now that the project has the Ivy nature, a new entry should have appeared in the properties of your project. This is where non Java dependencies are managed.
<center><img src="images/ivy_project_properties.jpg"/></center>
Now select "New..." to create a retrieve setup.
<center><img src="images/retrieve_setup.jpg"/></center>
<h4>Name</h4>
It gives a human readable name to the retrieve setup. This name will be used later in the context menu to actually launch a retreive of the dependencies.
For the sample project, let's choose "javascripts".
<h4>Ivy file</h4>
The ivy file which declares the dependencies to retrieve.
For the sample project, we will use the same one has the one which is used for the Java dependencies (it is not required).
<h4>Retrieve pattern</h4>
It defines where the dependencies should be retrieved.
For the sample project we want them there: <tt>src/org/apache/ivyde/sample/webappjsrepo/js/[artifact]-[revision].[ext]</tt>.
<h4>Delete old retrieved artifacts</h4>
Before doing a retrieve, the location where the dependencies are dowloaded will be wiped out is this option is selected.
<h4>Configurations</h4>
This is a comma separated list of configuration names which will be used for the resolve (<tt>*</tt> means <i>All</i>).
For the sample project, we want it to be <tt>js</tt>.
<h4>Types</h4>
This is a comma seperated list of type names which is be retrieved (<tt>*</tt> means <i>All</i>).
For the sample project, we want them all: <tt>*</tt>.
Now in the "Settings" tab, the setup entries are the same as the <a href="preferences.html#settings">global ones</a>. Click on "Enable project specific settings" to customize for your setup.
<center><img src="images/retrieve_setup_settings.jpg"/></center>
For the sample project, we want to use the ivysettings in the java project: <tt>${workspace_loc:ivyde-sample-webapp-js-repo/ivysettings.xml}</tt>.
Finally, click <b>OK</b> to finish.
<h1>Launch a retrieve</h1>
Now that the retrieve is setup, a new entry should be available in the "Ivy" context menu. The menu entry should be "Retrieve 'xxx'" where "xxx" is the name you gave to the retrieve setup. For the sample project, it will be "Retrieve 'javascripts'".
Select the entry to actually launch the retrieve. The Eclipse project get automatically refreshed with the retrieved files. For the sample project look into <tt>src/org/apache/ivyde/sample/webappjsrepo/js/jquery-1.7.1.min.js</tt>.
<center><img src="images/launch_standalone_retrieve.jpg"/></center>
<h1>Launch the sample webapp</h1>
To see the result, we'll launch the Java webapp and look it it your browser locally.
Right click the Java class <tt>org.apache.ivyde.sample.webappjsrepo.HTTPServer</tt> and select "Run As" / "Java Application".
Now open the web page http://localhost:8888/index.html
If working properly, the javascript files should have been properly loaded and the input field should have automatically been filled with a default value.
<center><img src="images/webapp-js-repo-launch.jpg"/></center>
</textarea>
<script type="text/javascript">xooki.postProcess();</script>
</body>
</html>