Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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
brew安装maven 404错误_Maven_Homebrew - Fatal编程技术网

brew安装maven 404错误

brew安装maven 404错误,maven,homebrew,Maven,Homebrew,我进行了brew安装maven,结果如下: ==> Downloading http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz ==> Best Mirror http://apache.oss.eznetsols.org/maven/binaries/apache-maven-3.0.4-bin.tar.gz curl: (22) The requested URL r

我进行了
brew安装maven
,结果如下:

==> Downloading http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz
==> Best Mirror http://apache.oss.eznetsols.org/maven/binaries/apache-maven-3.0.4-bin.tar.gz

curl: (22) The requested URL returned error: 404
Error: Download failed: http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz
起初我认为这是我的网络的镜像问题。但我换了另一个网络,它仍然是一样的。4天后仍然是相同的错误。我不知道其他人是否受到影响


要用brew安装maven,我应该怎么做?

此镜像有点奇怪。你可以用它来改变这个

brew edit maven
并将url更改为

e、 g

需要“公式”

class Maven < Formula
  homepage 'http://maven.apache.org/'
  #url 'http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz'
  url 'http://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz'
  sha1 '0de5dc162bafde3fcb0a6b009cfeea81a042523b'

  def install
    # Remove windows files
    rm_f Dir["bin/*.bat"]

    # Fix the permissions on the global settings file.
    chmod 0644, Dir["conf/settings.xml"]

    prefix.install %w{ NOTICE.txt LICENSE.txt README.txt }
    # Install jars in libexec to avoid conflicts
    libexec.install Dir['*']
    bin.install_symlink Dir["#{libexec}/bin/*"]
  end
end
class-Maven
如果url仍有错误,请尝试
brew update
然后
brew install maven
。为我解决了这个问题。

您需要使用brew edit修改URL,如Emoloney所说,
但最重要的是,不要忘记修改sha1代码(从url的同一下载页面获取)。重要的是要验证您是否安全下载了确切的文件

ZenBalance的答案对我有效。我首先尝试了Emoloney的回答,在运行
brew update
时导致以下错误:

error: Your local changes to the following files would be overwritten by merge:
Library/Formula/maven.rb
Please, commit your changes or stash them before you can merge.
Aborting Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
要解决此问题,请执行以下操作:

cd /usr/local/Library/Formula
git reset --hard
然后:


对我来说,以下命令起到了作用:

brew update
brew install maven

首先更新brew的镜像列表

brew update
然后,再次尝试安装。这个案子

brew install maven

我对这个新URL也有同样的问题。@fickle,您可以手动验证该URL,如果无法手动访问该URL,则它在brew中无法工作。最有可能的是maven版本不同,只需更新新版本,它就会像魔术一样工作。请参阅下面的自动解决方案,我会得到一个类似的错误:
==>下载http://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.4/binaries/ap 错误:无法确定镜像。请稍后再试。
谢谢-几年后新安装的自制软件仍然会出现这种情况,但运行brew update解决了这个问题。选择的答案显然不是最好的,因为它是特定于版本的(而且很乏味)。
brew install maven