2015-03-11 12 views
5

Ví dụ, khi tôi mở một dự án mã nguồn mở được phát triển tốt (như lucene) vào Eclipse (với cả ant build.xml và ivy ivysetting.xml), tôi có thể chạy ant với build.xml để xây dựng toàn bộ dự án thành công.ivy hoặc ivyDE có thể thêm các jars liên quan vào thư viện xây dựng đường dẫn JAVA tự động trong Eclipse không?

Tuy nhiên, dự án có đầy đủ các lỗi trong một loạt các lớp .java. Điều này được gây ra bằng cách hủy liên kết với các lọ bên ngoài. Những lọ này đã được tải xuống bởi ivy và được lưu trữ trong {user} /. Ivy2/cache /. Ngoài ra, khi tôi tự đặt từng lọ vào các đường dẫn xây dựng của dự án này, các lỗi đã biến mất.

ivy hoặc ivyDE hoặc một số công cụ khác có thể tự động đưa các lọ vào đường dẫn xây dựng JAVA không?

Đây là ivy-setting.xml:

<!-- 
 
    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.  
 
--> 
 
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 
     xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> 
 
    <info 
 
     organisation="" 
 
     module="lucene-5.0.0" 
 
     status="integration"> 
 
\t </info> 
 
<ivysettings> 
 
    <settings defaultResolver="default"/> 
 
    
 
    <property name="local-maven2-dir" value="${user.home}/.m2/repository/" /> 
 
    
 
    <properties file="${ivy.settings.dir}/ivy-versions.properties" override="false"/> 
 
    
 
    <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/> 
 
    <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/> 
 
    <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/> 
 
    <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/> 
 

 
    <caches lockStrategy="artifact-lock" resolutionCacheDir="${common.build.dir}/ivy-resolution-cache" /> 
 

 
    <resolvers> 
 
    <ibiblio name="sonatype-releases" root="https://oss.sonatype.org/content/repositories/releases" m2compatible="true" /> 
 
    <ibiblio name="maven.restlet.org" root="http://maven.restlet.org" m2compatible="true" /> 
 
    <ibiblio name="releases.cloudera.com" root="http://repository.cloudera.com/content/repositories/releases" m2compatible="true" /> 
 
    
 
    <!-- needed only for newer svnkit releases, e.g. 1.8.x --> 
 
    <ibiblio name="svnkit-releases" root="http://maven.tmatesoft.com/content/repositories/releases" m2compatible="true" /> 
 

 
    <!-- you might need to tweak this from china so it works --> 
 
    <ibiblio name="working-chinese-mirror" root="http://uk.maven.org/maven2" m2compatible="true" /> 
 
    
 
    <!-- 
 
    <filesystem name="local-maven-2" m2compatible="true" local="true"> 
 
     <artifact 
 
      pattern="${local-maven2-dir}/[organisation]/[module]/[revision]/[module]-[revision].[ext]" /> 
 
     <ivy 
 
      pattern="${local-maven2-dir}/[organisation]/[module]/[revision]/[module]-[revision].pom" /> 
 
    </filesystem> 
 
    --> 
 

 
    <chain name="default" returnFirst="true" checkmodified="true" changingPattern=".*SNAPSHOT"> 
 
     <resolver ref="local"/> 
 
     <!-- <resolver ref="local-maven-2" /> --> 
 
     <resolver ref="main"/> 
 
     <resolver ref="maven.restlet.org" /> 
 
     <resolver ref="sonatype-releases" /> 
 
     <resolver ref="releases.cloudera.com"/> 
 
     <!-- <resolver ref="svnkit-releases" /> --> 
 
     <resolver ref="working-chinese-mirror" /> 
 
    </chain> 
 
    </resolvers> 
 

 
</ivysettings> 
 
</ivy-module>

Trả lời

-1

Bạn cần phải thêm ivysettings.xml tập tin để dự án của bạn và đặt nó trong Preferences (Window -> Preferences -> Ivy -> Cài đặt: Đường dẫn cài đặt Ivy). Khi nó vắng mặt, ivy không biết nơi để tìm phụ thuộc.

(Có lẽ nó là đủ để add file vào một trong những dự án của mình, nhưng tôi không chắc chắn.)

1

Nó sẽ nếu bạn sử dụng Ivy Eclipse plugin. Nếu bạn đã cài đặt nó, bạn sẽ cần phải thêm thời gian chạy IVY vào đường dẫn xây dựng của dự án. Điều này có thể được thực hiện thông qua Project Properties-> Java Build Path trong tab Libraries, chọn Add Library sau đó chọn IvyDE Managed Dependencies.

Khi đã xong, một giải pháp Ivy sẽ thêm tất cả các lọ được chỉ định trong ivy.xml vào đường dẫn xây dựng của dự án.

+0

Điều này không hoạt động được .. –

+0

IvyDE của tôi là 2.2 và được thực hiện thông qua Project Properties-> Java Build Path trong tab Libraries, chọn Add Library sau đó chọn IvyDE Managed Dependencies. Và, Chính: Tệp Ivy: ivy-setting.xml, Classpath: được chọn "Bật cài đặt được chỉ định của dự án" và chọn "Giải quyết sự phụ thuộc trong không gian làm việc". Tuy nhiên, khi tôi giải quyết dự án nó đã không hoạt động. Thêm Tôi đã thêm tệp xml vào phần mô tả câu hỏi. –

+0

"nó không hoạt động" theo cách nào? bạn đã nhận được một số loại lỗi? bạn có thấy thư viện Ivy trong classpath không? Nó có bất kỳ lọ nào trong đó không? –

Các vấn đề liên quan