File: 02-do-not-hard-code-maven-version.patch

package info (click to toggle)
ruby-maven-libs 3.3.9%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 128 kB
  • sloc: ruby: 40; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 890 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: Do not hard-code Maven version in source code
Author: Miguel Landaeta <nomadium@debian.org>
Forwarded: no
Last-Update: 2017-03-09

--- a/lib/maven.rb
+++ b/lib/maven.rb
@@ -1,6 +1,14 @@
 module Maven
 
-  VERSION = '3.3.9'.freeze
+  # $ mvn --version
+  # Apache Maven 3.3.9
+  # Maven home: /usr/share/maven
+  # Java version: 1.8.0_121, vendor: Oracle Corporation
+  # Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
+  # Default locale: en_US, platform encoding: UTF-8
+  # OS name: "linux", version: "4.9.0-1-amd64", arch: "amd64", family: "unix"
+  mvn_cmd_path = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', '..', 'bin', 'mvn')
+  VERSION = `#{mvn_cmd_path} --version`.split("\n")[0].split[2].chomp("\e[m").freeze # => "3.3.9"
 
   def self.exec( *args )
     if args.member?( '-Dverbose=true' ) || args.member?( '-Dverbose' ) || args.member?( '-X' )