-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
mvnvm.rb
55 lines (50 loc) 路 2.01 KB
/
mvnvm.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Mvnvm < Formula
desc "Maven version manager"
# upstream homepage bug report, https://bitbucket.org/mjensen/mvnvm/issues/41/https-mvnvmorg-is-not-reachable
homepage "https://bitbucket.org/mjensen/mvnvm/"
url "https://bitbucket.org/mjensen/mvnvm/get/mvnvm-1.0.26.tar.gz"
sha256 "9f3572114ae983b24c5bd36e2ef5124daa606298be33986e726b79fcd44d486c"
license "Apache-2.0"
head "https://bitbucket.org/mjensen/mvnvm.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, all: "24779d38d6951058a609d6819b97a6cc01ca9220848ea78587fcc427209453c2"
end
depends_on "openjdk"
conflicts_with "maven", because: "also installs a 'mvn' executable"
def install
bin.install "mvn"
bin.install "mvnDebug"
bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env
end
test do
(testpath/"settings.xml").write <<~EOS
<settings><localRepository>#{testpath}/repository</localRepository></settings>
EOS
(testpath/"mvnvm.properties").write <<~EOS
mvn_version=3.5.2
EOS
(testpath/"pom.xml").write <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.homebrew</groupId>
<artifactId>maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
EOS
(testpath/"src/main/java/org/homebrew/MavenTest.java").write <<~EOS
package org.homebrew;
public class MavenTest {
public static void main(String[] args) {
System.out.println("Testing Maven with Homebrew!");
}
}
EOS
system "#{bin}/mvn", "-gs", "#{testpath}/settings.xml", "compile"
end
end