Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
指示Maven从下载第三方插件https://oss.sonatype.org/content_Maven_Maven Plugin - Fatal编程技术网

指示Maven从下载第三方插件https://oss.sonatype.org/content

指示Maven从下载第三方插件https://oss.sonatype.org/content,maven,maven-plugin,Maven,Maven Plugin,我想在上面使用一个插件 我知道运行插件的maven命令,但是我如何指导maven从哪里下载插件呢? 我想我需要将我的设置文件更新为: <mirrors> <mirror> <id>???</id> <name>???</name> <url>https://oss.sonatype.org/content/repositories/snapshots/&l

我想在上面使用一个插件 我知道运行插件的maven命令,但是我如何指导maven从哪里下载插件呢? 我想我需要将我的设置文件更新为:

 <mirrors>
    <mirror>
        <id>???</id>
        <name>???</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </mirror>
</mirrors>

???
???
https://oss.sonatype.org/content/repositories/snapshots/

这是否正确?

最好的解决方案是将当前配置仅用于以下测试:

<project>
  ...
  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>http://repository.apache.org/snapshots/</url>
    </pluginRepository>
  </pluginRepositories>
  ...
</project>
<settings>
  ...
  <profiles>
    <profile>
      <id>apache</id>
      <pluginRepositories>
        <pluginRepository>
          <id>apache.snapshots</id>
          <name>Maven Plugin Snapshots</name>
          <url>http://repository.apache.org/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  ...
</settings>

...
apache.snapshots
http://repository.apache.org/snapshots/
...
或者像这样适当地更改您的设置:

<project>
  ...
  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>http://repository.apache.org/snapshots/</url>
    </pluginRepository>
  </pluginRepositories>
  ...
</project>
<settings>
  ...
  <profiles>
    <profile>
      <id>apache</id>
      <pluginRepositories>
        <pluginRepository>
          <id>apache.snapshots</id>
          <name>Maven Plugin Snapshots</name>
          <url>http://repository.apache.org/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  ...
</settings>

...
阿帕奇
apache.snapshots
Maven插件快照
http://repository.apache.org/snapshots/
假的
真的
...

当然,激活个人资料。或者更改存储库管理器的配置。

您应该将存储库添加到pom中,这样构建将保持可移植性,构建代码的其他开发人员将不需要更新其settings.xml

这应该可以做到:

<repositories>
    <repository>
        <id>repo-id</id>
        <name>repo-name</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
</repositories>

回购id
回购协议名称
https://oss.sonatype.org/content/repositories/snapshots/

我建议阅读:因为pom中的存储库是一个坏主意,而且与此相反:它会使您的构建不可移植。