Skip to content

Instantly share code, notes, and snippets.

@edehde
Last active June 3, 2019 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save edehde/6240329 to your computer and use it in GitHub Desktop.
Save edehde/6240329 to your computer and use it in GitHub Desktop.
enables brew install maven30

Motivation

https://github.com/mxcl/homebrew/blob/master/Library/Formula/maven.rb defaults to 3.1.0 as of now. Thus similar to https://github.com/Homebrew/homebrew-versions/blob/master/maven2.rb I saved my own formula as a gist (using mxcl/homebrew@b4725ca259a07b85e6bb20c71bcec67b7d457c42 without the detect java patch) to be able to install 3.0.x.

See also brew versions maven:

3.1.0    git checkout f160fa9 Library/Formula/maven.rb
3.0.5    git checkout b4725ca Library/Formula/maven.rb
3.0.4    git checkout d7a19f2 Library/Formula/maven.rb
3.0.3    git checkout 14e4db3 Library/Formula/maven.rb
3.0.2    git checkout 03b288a Library/Formula/maven.rb
3.0.1    git checkout 83857d6 Library/Formula/maven.rb
3.0      git checkout 09a0264 Library/Formula/maven.rb
2.2.1    git checkout d40d419 Library/Formula/maven.rb

Usage

brew install https://raw.github.com/gist/6240329/maven30.rb

Example verbose output:

brew install -v https://raw.github.com/gist/6240329/maven30.rb
/usr/bin/curl -f#LA Homebrew 0.9.4 (Ruby 1.8.7-358; Mac OS X 10.8.4) https://raw.github.com/gist/6240329/maven30.rb -o /Library/Caches/Homebrew/Formula/maven30.rb
######################################################################## 100.0%
==> Downloading http://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
==> Best Mirror http://mirror.tcpdiag.net/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
/usr/bin/curl -f#LA Homebrew 0.9.4 (Ruby 1.8.7-358; Mac OS X 10.8.4) http://mirror.tcpdiag.net/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz -C 0 -o /Library/Caches/Homebrew/maven30-3.0.5.tar.gz.incomplete
######################################################################## 100.0%
tar xf /Library/Caches/Homebrew/maven30-3.0.5.tar.gz
==> Cleaning
==> Finishing up
ln -s ../Cellar/maven30/3.0.5/bin/mvnyjp mvnyjp
ln -s ../Cellar/maven30/3.0.5/bin/mvnDebug mvnDebug
ln -s ../Cellar/maven30/3.0.5/bin/mvn mvn
ln -s ../Cellar/maven30/3.0.5/bin/m2.conf m2.conf
ln -s ../../Cellar/maven30/3.0.5 maven30
ln -s ../Cellar/maven30/3.0.5 maven30
==> Summary
   /usr/local/Cellar/maven30/3.0.5: 40 files, 5.7M, built in 11 second

mvn --version output:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /usr/local/Cellar/maven30/3.0.5/libexec
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
require 'formula'
class Maven30 < Formula
homepage 'http://maven.apache.org/'
url 'http://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz'
sha1 'aecc0d3d67732939c0056d4a0d8510483ee1167e'
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_metafiles
libexec.install Dir['*']
bin.install_symlink Dir["#{libexec}/bin/*"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment