一、前言
关于eclipse中将项目第三方库改为从ivy仓库引用,无需进行配置ivysettings(eclipse-ivyide插件安装教程),具体参见如下操作步骤。
二、操作步骤
1. 先在项目创建测试java project项目(可以任意创建项目如web Project)
2. 如下图在项目创建ivy.xml的依赖配置
3. 右击项目中生成的ivy.xml,增加commons-lang和gson依赖进行测试(增加<dependencies>..</dependencies>节点内容),具体内容如下
<?xml version="1.0" encoding="ISO-8859-1"?>@b@<!--@b@ Licensed to the Apache Software Foundation (ASF) under one@b@ or more contributor license agreements. See the NOTICE file@b@ distributed with this work for additional information@b@ regarding copyright ownership. The ASF licenses this file@b@ to you under the Apache License, Version 2.0 (the@b@ "License"); you may not use this file except in compliance@b@ with the License. You may obtain a copy of the License at@b@@b@ http://www.apache.org/licenses/LICENSE-2.0@b@@b@ Unless required by applicable law or agreed to in writing,@b@ software distributed under the License is distributed on an@b@ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY@b@ KIND, either express or implied. See the License for the@b@ specific language governing permissions and limitations@b@ under the License. @b@-->@b@<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"@b@ xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">@b@ <info@b@ organisation=""@b@ module="ivy-base"@b@ status="integration">@b@ </info>@b@ @b@ <dependencies> @b@ <dependency org="com.google.code.gson" name="gson" rev="1.7.1" /> @b@ <dependency org="commons-lang" name="commons-lang" rev="2.1" /> @b@ </dependencies> @b@ @b@</ivy-module>
4. 右击ivy.xml,选择菜单中“Add Ivy Library...”项
5. 在弹出的下面窗口,直接点击finish
6. 直接从vy默认maven库(如需修改默认下载地址参见教程)中离线下载到本地并引入到项目中