@@ -31,8 +31,6 @@ def self.exec( *args )
3131 args << 'settings.xml'
3232 end
3333 if args . member? ( '-version' ) or args . member? ( '--version' ) or args . member? ( '-v' )
34- warn "here"
35- warn "Polyglot Maven Extension #{ Maven ::Ruby ::POLYGLOT_VERSION } via ruby-maven #{ Maven ::Ruby ::VERSION } "
3634 launch ( '--version' )
3735 elsif defined? Bundler
3836 # it can be switching from ruby to jruby with invoking maven
@@ -65,6 +63,9 @@ def self.version
6563 end
6664
6765 def self . launch ( *args )
66+ if args . member? ( '--version' ) or args . member? ( '--show-version' )
67+ warn "Polyglot Maven Extension #{ Maven ::Ruby ::POLYGLOT_VERSION } via ruby-maven #{ Maven ::Ruby ::VERSION } "
68+ end
6869 old_maven_home = ENV [ 'M2_HOME' ]
6970 ENV [ 'M2_HOME' ] = Maven . home
7071 ext_dir = File . join ( Maven . lib , 'ext' )
@@ -74,13 +75,14 @@ def self.launch( *args )
7475 file =~ /.*\. jar$/
7576 end . each do |jar |
7677 source = File . join ( local_dir , jar )
77- if jar == " polyglot-ruby -#{ Maven ::Ruby ::POLYGLOT_VERSION } .jar"
78+ if jar =~ / polyglot-.* -#{ Maven ::Ruby ::POLYGLOT_VERSION } .jar/
7879 # ruby maven defines the polyglot version and this jar sets up its classpath
7980 # i.e. on upgrade or downgrade the right version will be picked
80- FileUtils . cp ( source , File . join ( ext_dir , "polyglot-ruby. jar" ) )
81- elsif not File . exists? ( File . join ( ext_dir , jar ) )
81+ FileUtils . cp ( source , File . join ( ext_dir , jar . sub ( /-[0-9.]*(-SNAPSHOT)?. jar$/ , '.jar' ) ) )
82+ elsif not File . exists? ( File . join ( ext_dir , jar ) ) and not jar =~ /jruby-(core|stdlib).*/
8283 # jar files are immutable as they carry the version
83- FileUtils . cp ( source , ext_dir )
84+ warn jar
85+ FileUtils . cp ( source , File . join ( ext_dir , jar . sub ( /-9.4.5.0/ , '' ) ) )
8486 end
8587 end
8688
0 commit comments