13

いくつかの制限があるため、完全にオフラインのMavenリポジトリが必要です。http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionExceptionによると、プラグインのみ<pluginRepositories>が検索されます。そのため、ローカルファイルシステムでプラグインを検索するようにMavenを構成する方法を考えています。設定時に「file://」プレフィックスを使用してみ<url>ましたが、機能しません。

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.

dsun@localhost:> 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

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>

4

3 に答える 3

10

最後に、問題を見つけました。プラグインディレクトリに_maven.repositoriesというファイルがあります。ファイルを削除すると、すべて正常に機能します。

詳細については、次のリンクを参照してください。

于 2012-11-22T02:03:02.107 に答える
8

Maven 3.1-alpha-1 以降、コマンド ライン オプション-llr/--legacy-local-repository またはシステム プロパティ-Dmaven.legacyLocalRepo=true が役立つはずです。

Maven を使用したオフラインでの作業に関する一般的な回答については、こちらを参照してください

于 2014-07-06T21:07:22.360 に答える