2012-11-21 27 views
10

Tôi cần có kho lưu trữ maven hoàn toàn ngoại tuyến do một số hạn chế. Theo số http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException, chỉ <pluginRepositories> mới được tìm kiếm các plugin. Vì vậy, tôi tự hỏi làm thế nào để cấu hình maven để tìm kiếm bổ sung trong một hệ thống tập tin địa phương. Tôi đã thử sử dụng tiền tố "file: //" khi thiết lập <url> nhưng nó không hoạt động.Cách thiết lập kho lưu trữ plugin cục bộ maven 3

DEBUG] Verifying availability of /home/dsun/.m2/repository/org/apache/karaf/tooling/features-maven-plugin/2.3.0/features-maven-plugin-2.3.0.jar from [central (http://repo1.maven.org/maven2, releases=true, snapshots=false, managed=false)] 
[ERROR] Plugin org.apache.karaf.tooling:features-maven-plugin:2.3.0 or one of its dependencies could not be resolved: The repository system is offline but the artifact org.apache.karaf.tooling:features-maven-plugin:jar:2.3.0 is not available in the local repository. -> [Help 1] 
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.karaf.tooling:features-maven-plugin:2.3.0 or one of its dependencies could not be resolved: The repository system is offline but the artifact org.apache.karaf.tooling:features-maven-plugin:jar:2.3.0 is not available in the local repository. 

[email protected]:> ls /home/dsun/.m2/repository/org/apache/karaf/tooling/features-maven-plugin/2.3.0/features-maven-plugin-2.3.0.jar 
/home/dsun/.m2/repository/org/apache/karaf/tooling/features-maven-plugin/2.3.0/features-maven-plugin-2.3.0.jar 

Các settings.xml

<settings>  
<offline>true</offline> 
    <profiles> 
    <profile> 
    <id>local</id> 
    <pluginRepositories> 
     <pluginRepository> 
     <id>central</id> 
     <url>file://${env.HOME}/.m2/repository</url> 
     <releases> 
     <enabled>true</enabled> 
     </releases> 
     <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
    </pluginRepository> 
    </pluginRepositories> 
    </profile> 
</profiles> 
<activeProfiles> 
    <activeProfile>local</activeProfile> 
</activeProfiles> 

<localRepository>${env.HOME}/.m2/repository</localRepository> 

+1

Tôi không chắc chắn, nhưng có thể bài đăng này sẽ hữu ích cho bạn: http://stackoverflow.com/questions/5141211/maven-without-remote-repository –

+0

Cấu hình của bạn không thể hoạt động vì bạn đang xác định kho lưu trữ nguồn giống như kho lưu trữ đích (.m2/repository). Bạn cần phải có một dây đeo khởi động ban đầu nơi để bắt đầu từ và sau khi tất cả các bản xây dựng của bạn đang làm việc bạn có thể thiết lập. – khmarbaise

+0

hi khmarbaise, bạn có thể giải thích chi tiết không? bạn có ý nghĩa gì "kho lưu trữ nguồn"? Plugin cần thiết đã có trong kho lưu trữ cục bộ của tôi. Và tôi đã cố gắng loại bỏ tất cả các dòng trong tệp settings.xml ngoại trừ , nó cũng không hoạt động. – SunLiWei

Trả lời

4

Kể từ Maven 3.1-alpha-1, tùy chọn dòng lệnh -llr/--legacy-local-repository hoặc thuộc tính hệ thống -Dmaven.legacyLocalRepo=true shoul d giúp đỡ

+0

Mẹo hay để tìm các plugin Maven trong repo cục bộ (hệ thống tập tin);) –

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