maven-tools 1.0.0.rc2 → 1.0.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -0
  3. data/Mavenfile +22 -0
  4. data/Rakefile +44 -0
  5. data/lib/maven/tools/coordinate.rb +6 -1
  6. data/lib/maven/tools/dsl.rb +116 -42
  7. data/lib/maven/tools/model.rb +336 -334
  8. data/lib/maven/tools/pom.rb +4 -5
  9. data/lib/maven/tools/version.rb +1 -1
  10. data/lib/maven/tools/versions.rb +4 -7
  11. data/lib/maven/tools/visitor.rb +22 -7
  12. data/maven-tools.gemspec +39 -0
  13. data/spec/artifact_spec.rb +30 -10
  14. data/spec/coordinate_spec.rb +1 -1
  15. data/spec/gemfile/Gemfile +7 -0
  16. data/spec/gemfile/Mavenfile +5 -0
  17. data/spec/gemfile/bouncy-castle-java.gemspec +20 -0
  18. data/spec/gemfile/pom.xml +79 -0
  19. data/spec/gemfile_include_jars/Gemfile +5 -0
  20. data/spec/gemfile_include_jars/Mavenfile +5 -0
  21. data/spec/gemfile_include_jars/bouncy-castle-java.gemspec +20 -0
  22. data/spec/gemfile_include_jars/pom.xml +74 -0
  23. data/spec/gemfile_with_access_to_model/Gemfile +5 -0
  24. data/spec/gemfile_with_access_to_model/Mavenfile +7 -0
  25. data/spec/gemfile_with_access_to_model/bouncy-castle-java.gemspec +16 -0
  26. data/spec/gemfile_with_access_to_model/pom.xml +62 -0
  27. data/spec/gemfile_with_custom_source/Gemfile +5 -0
  28. data/spec/gemfile_with_custom_source/Mavenfile +5 -0
  29. data/spec/gemfile_with_custom_source/bouncy-castle-java.gemspec +19 -0
  30. data/spec/gemfile_with_custom_source/pom.xml +107 -0
  31. data/spec/gemfile_with_custom_source/src/java/.keep +0 -0
  32. data/spec/gemfile_with_custom_source_and_custom_jarname/Gemfile +5 -0
  33. data/spec/gemfile_with_custom_source_and_custom_jarname/Mavenfile +5 -0
  34. data/spec/gemfile_with_custom_source_and_custom_jarname/bouncy-castle-java.gemspec +18 -0
  35. data/spec/gemfile_with_custom_source_and_custom_jarname/pom.xml +107 -0
  36. data/spec/gemfile_with_custom_source_and_custom_jarname/src/java/.keep +0 -0
  37. data/spec/gemfile_with_extras/Gemfile +5 -0
  38. data/spec/gemfile_with_extras/Mavenfile +21 -0
  39. data/spec/gemfile_with_extras/bouncy-castle-java.gemspec +20 -0
  40. data/spec/gemfile_with_extras/pom.xml +106 -0
  41. data/spec/gemfile_with_groups/Gemfile +9 -0
  42. data/spec/gemfile_with_groups/Mavenfile +5 -0
  43. data/spec/gemfile_with_groups/pom.xml +44 -0
  44. data/spec/gemfile_with_groups_and_lockfile/Gemfile +10 -0
  45. data/spec/gemfile_with_groups_and_lockfile/Gemfile.lock +34 -0
  46. data/spec/gemfile_with_groups_and_lockfile/Mavenfile +5 -0
  47. data/spec/gemfile_with_groups_and_lockfile/pom.xml +155 -0
  48. data/spec/gemfile_with_lock/Gemfile +7 -0
  49. data/spec/gemfile_with_lock/Gemfile.lock +42 -0
  50. data/spec/gemfile_with_lock/Mavenfile +5 -0
  51. data/spec/gemfile_with_lock/bouncy-castle-java.gemspec +22 -0
  52. data/spec/gemfile_with_lock/pom.xml +197 -0
  53. data/spec/gemfile_with_path/Gemfile +7 -0
  54. data/spec/gemfile_with_path/Mavenfile +5 -0
  55. data/spec/gemfile_with_path/pom.xml +63 -0
  56. data/spec/gemfile_with_source/Mavenfile +5 -0
  57. data/spec/gemfile_with_source/bouncy-castle-java.gemspec +21 -0
  58. data/spec/gemfile_with_source/pom.xml +103 -0
  59. data/spec/gemfile_with_source/src/main/java/.keep +0 -0
  60. data/spec/gemfile_with_source_and_custom_jarname/Gemfile +5 -0
  61. data/spec/gemfile_with_source_and_custom_jarname/Mavenfile +5 -0
  62. data/spec/gemfile_with_source_and_custom_jarname/bouncy-castle-java.gemspec +19 -0
  63. data/spec/gemfile_with_source_and_custom_jarname/pom.xml +106 -0
  64. data/spec/gemfile_with_source_and_custom_jarname/src/main/java/.keep +0 -0
  65. data/spec/gemfile_with_source_and_no_jar/Gemfile +5 -0
  66. data/spec/gemfile_with_source_and_no_jar/Mavenfile +5 -0
  67. data/spec/gemfile_with_source_and_no_jar/bouncy-castle-java.gemspec +19 -0
  68. data/spec/gemfile_with_source_and_no_jar/pom.xml +76 -0
  69. data/spec/gemfile_with_source_and_no_jar/src/main/java/.keep +0 -0
  70. data/spec/gemspec/Mavenfile +5 -0
  71. data/spec/gemspec/bouncy-castle-java.gemspec +20 -0
  72. data/spec/gemspec/pom.xml +73 -0
  73. data/spec/gemspec_in_profile/Mavenfile +7 -0
  74. data/spec/gemspec_in_profile/bouncy-castle-java.gemspec +20 -0
  75. data/spec/gemspec_in_profile/pom.xml +57 -0
  76. data/spec/gemspec_include_jars/Mavenfile +5 -0
  77. data/spec/gemspec_include_jars/bouncy-castle-java.gemspec +20 -0
  78. data/spec/gemspec_include_jars/pom.xml +74 -0
  79. data/spec/gemspec_no_rubygems_repo/Mavenfile +5 -0
  80. data/spec/gemspec_no_rubygems_repo/bouncy-castle-java.gemspec +17 -0
  81. data/spec/gemspec_no_rubygems_repo/pom.xml +64 -0
  82. data/spec/gemspec_prerelease/Mavenfile +5 -0
  83. data/spec/gemspec_prerelease/bouncy-castle-java.gemspec +17 -0
  84. data/spec/gemspec_prerelease/pom.xml +70 -0
  85. data/spec/gemspec_prerelease_snapshot/Mavenfile +5 -0
  86. data/spec/gemspec_prerelease_snapshot/bouncy-castle-java.gemspec +17 -0
  87. data/spec/gemspec_prerelease_snapshot/pom.xml +70 -0
  88. data/spec/gemspec_with_access_to_model/Mavenfile +7 -0
  89. data/spec/gemspec_with_access_to_model/bouncy-castle-java.gemspec +16 -0
  90. data/spec/gemspec_with_access_to_model/pom.xml +62 -0
  91. data/spec/gemspec_with_custom_source/Mavenfile +5 -0
  92. data/spec/gemspec_with_custom_source/bouncy-castle-java.gemspec +19 -0
  93. data/spec/gemspec_with_custom_source/pom.xml +107 -0
  94. data/spec/gemspec_with_custom_source/src/java/.keep +0 -0
  95. data/spec/gemspec_with_custom_source_and_custom_jarname/Mavenfile +5 -0
  96. data/spec/gemspec_with_custom_source_and_custom_jarname/bouncy-castle-java.gemspec +18 -0
  97. data/spec/gemspec_with_custom_source_and_custom_jarname/pom.xml +107 -0
  98. data/spec/gemspec_with_custom_source_and_custom_jarname/src/java/.keep +0 -0
  99. data/spec/gemspec_with_extras/Mavenfile +21 -0
  100. data/spec/gemspec_with_extras/bouncy-castle-java.gemspec +20 -0
  101. data/spec/gemspec_with_extras/pom.xml +106 -0
  102. data/spec/gemspec_with_prereleased_dependency/Mavenfile +5 -0
  103. data/spec/gemspec_with_prereleased_dependency/bouncy-castle-java.gemspec +17 -0
  104. data/spec/gemspec_with_prereleased_dependency/pom.xml +80 -0
  105. data/spec/gemspec_with_prereleased_dependency_and_no_repo/Mavenfile +5 -0
  106. data/spec/gemspec_with_prereleased_dependency_and_no_repo/bouncy-castle-java.gemspec +17 -0
  107. data/spec/gemspec_with_prereleased_dependency_and_no_repo/pom.xml +76 -0
  108. data/spec/gemspec_with_source/Mavenfile +5 -0
  109. data/spec/gemspec_with_source/bouncy-castle-java.gemspec +21 -0
  110. data/spec/gemspec_with_source/pom.xml +103 -0
  111. data/spec/gemspec_with_source/src/main/java/.keep +0 -0
  112. data/spec/gemspec_with_source_and_custom_jarname/Mavenfile +5 -0
  113. data/spec/gemspec_with_source_and_custom_jarname/bouncy-castle-java.gemspec +19 -0
  114. data/spec/gemspec_with_source_and_custom_jarname/pom.xml +106 -0
  115. data/spec/gemspec_with_source_and_custom_jarname/src/main/java/.keep +0 -0
  116. data/spec/gemspec_with_source_and_no_jar/Mavenfile +5 -0
  117. data/spec/gemspec_with_source_and_no_jar/bouncy-castle-java.gemspec +19 -0
  118. data/spec/gemspec_with_source_and_no_jar/pom.xml +76 -0
  119. data/spec/gemspec_with_source_and_no_jar/src/main/java/.keep +0 -0
  120. data/spec/mavenfile/Mavenfile +894 -0
  121. data/spec/my/my-1.0.gem +0 -0
  122. data/spec/my/my.gemspec +10 -0
  123. data/spec/pom.xml +423 -0
  124. data/spec/pom_from_jarfile/Jarfile +3 -0
  125. data/spec/pom_from_jarfile/pom.xml +39 -0
  126. data/spec/pom_maven_alternative_style/pom.rb +57 -6
  127. data/spec/pom_maven_hash_style/pom.rb +56 -175
  128. data/spec/pom_maven_style/pom.rb +59 -6
  129. data/spec/pom_spec.rb +1 -1
  130. data/spec/pom_with_execute/pom.xml +92 -0
  131. metadata +246 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0043d501457131717a2e0d1b85efddcabe5723c0
4
- data.tar.gz: 631f64b5a850b277e3ffca5bff4ec0f2ffba265a
3
+ metadata.gz: a1e5bc2012d479ffdc03fb2f26ceed4742c4e18f
4
+ data.tar.gz: 0f3a6dc35832902b581ecae534a1c9b72a992bd6
5
5
  SHA512:
6
- metadata.gz: 455460b23c182cf47ca87631a33176befbdf815cefede9492e8a7e6b5b1c7507bd8d11fd1dc700a826315c5770414bb9e2e450485a0cc6815cf745d2ab444028
7
- data.tar.gz: 11024c1588037abc38e39cc11da922c5b391c3e4c98d62456ccdd71b4cc3b7f8e32e0da7723e23d716e6e2f740e3c4d3816ad854bffcf33a6425fa6ee047804d
6
+ metadata.gz: e89dd1f2f0ec03b31e8cfc65320b32c3118c8fc89e52ecae2edba976a95be9c9374ad493a5d9850258bad1c523fb11b6c0ef78cd7d08d6c3c79c0cc90d4a9fc6
7
+ data.tar.gz: aabc6fc377baec627b823a49700c58cfbdd0d16e910b12bda246060443c5b51ea91fea0efb83129729f9334d4820d9a120187cde54d57d8bfb01e5a0522c35b4
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ #-*- mode: ruby -*-
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
5
+
6
+ gem "copyright-header", "1.0.8", :platform => :mri, :group => :copyright
7
+
8
+ # vim: syntax=Ruby
@@ -0,0 +1,22 @@
1
+ #-*- mode: ruby -*-
2
+
3
+ gemspec
4
+
5
+ plugin( 'de.saumya.mojo:minitest-maven-plugin', '${jruby.plugins.version}',
6
+ :minispecDirectory =>"spec/*spec.rb" ) do
7
+ execute_goals(:spec)
8
+ end
9
+
10
+ properties( # lock down versions
11
+ 'jruby.plugins.version' => '1.0.1',
12
+ 'jruby.version' => '1.7.12',
13
+
14
+ # running the specs with this matrix
15
+ # (jruby-1.6.7 produces a lot of yaml errors parsing gemspecs)
16
+ # overwrite via cli -Djruby.versions=9000.dev-SNAPSHOT
17
+ 'jruby.versions' => ['1.7.4','1.7.12'].join(','),
18
+ # overwrite via cli -Djruby.modes=2.0
19
+ 'jruby.modes' => '1.9,2.0,2.1'
20
+ )
21
+
22
+ # vim: syntax=Ruby
@@ -0,0 +1,44 @@
1
+ #-*- mode: ruby -*-
2
+
3
+ begin
4
+ require 'maven/ruby/tasks'
5
+ rescue LoadError
6
+ # ignore - can not add as development dependency to avoid circular dependencies
7
+ end
8
+
9
+ task :default => [ :specs ]
10
+
11
+ desc 'run minispecs'
12
+ task :specs do
13
+ begin
14
+ require 'minitest'
15
+ rescue LoadError
16
+ end
17
+ require 'minitest/autorun'
18
+
19
+ $LOAD_PATH << "spec"
20
+ $LOAD_PATH << "lib"
21
+
22
+ Dir['spec/*_spec.rb'].each { |f| require File.basename(f.sub(/.rb$/, '')) }
23
+ end
24
+
25
+ task :headers do
26
+ require 'copyright_header'
27
+
28
+ s = Gem::Specification.load( Dir["*gemspec"].first )
29
+
30
+ args = {
31
+ :license => s.license,
32
+ :copyright_software => s.name,
33
+ :copyright_software_description => s.description,
34
+ :copyright_holders => s.authors,
35
+ :copyright_years => [Time.now.year],
36
+ :add_path => "lib:src",
37
+ :output_dir => './'
38
+ }
39
+
40
+ command_line = CopyrightHeader::CommandLine.new( args )
41
+ command_line.execute
42
+ end
43
+
44
+ # vim: syntax=Ruby
@@ -149,7 +149,12 @@ module Maven
149
149
  [(nil || low), "#{snapshot_version(val)})"]
150
150
  elsif arg =~ /\=/
151
151
  val = arg.sub(/=\s*/, '')
152
- ["[#{snapshot_version(val)}", val + '.0.0.0.0.1)']
152
+ # for prereleased version pick the maven version (no version range)
153
+ if val.match /[a-z]|[A-Z]/
154
+ [ val, val ]
155
+ else
156
+ ["[#{val}", "#{val}.0.0.0.0.1)"]
157
+ end
153
158
  else
154
159
  # no conversion here, i.e. assume maven version
155
160
  [arg, arg]
@@ -19,7 +19,7 @@ module Maven
19
19
  @context = :project
20
20
  nested_block( :project, @model, block ) if block
21
21
  if @needs_torquebox
22
- if ! @model.repositories.detect { |r| r.id == 'rubygems-prereleases' } && @model.dependencies.detect { |d| d.group_id == 'rubygems' && d.version.match( /[a-zA-Z]/ ) }
22
+ if ! @model.repositories.detect { |r| r.id == 'rubygems-prereleases' } && @model.dependencies.detect { |d| d.group_id == 'rubygems' && d.version.match( /-SNAPSHOT/ ) }
23
23
 
24
24
  @current = @model
25
25
  snapshot_repository( 'rubygems-prereleases',
@@ -46,8 +46,8 @@ module Maven
46
46
  @model
47
47
  end
48
48
 
49
- def eval_pom( src, reference_file = '.' )
50
- @source = reference_file
49
+ def eval_pom( src, reference_file )
50
+ @source = reference_file || '.'
51
51
  eval( src, nil, ::File.expand_path( @source ) )
52
52
  ensure
53
53
  @source = nil
@@ -110,23 +110,31 @@ module Maven
110
110
  name = 'Gemfile'
111
111
  end
112
112
  name = ::File.join( basedir, name ) unless ::File.exists?( name )
113
- basedir = ::File.dirname( name ) unless basedir
114
-
115
- @inside_gemfile = true
113
+
114
+ @inside_gemfile = true
116
115
  # the eval might need those options for gemspec declaration
117
- pr = profile :gemfile do
118
- activation do
119
- file( :missing => name + '.lock' )
116
+ lockfile = ::File.expand_path( name + '.lock' )
117
+ if File.exists? lockfile
118
+ pr = profile :gemfile do
119
+ activation do
120
+ file( :missing => name + '.lock' )
121
+ end
122
+
123
+ FileUtils.cd( basedir ) do
124
+ f = ::File.expand_path( name )
125
+ eval( ::File.read( f ), nil, f )
126
+ end
120
127
  end
121
-
128
+ @inside_gemfile = :gemfile
129
+ else
122
130
  FileUtils.cd( basedir ) do
123
131
  f = ::File.expand_path( name )
124
132
  eval( ::File.read( f ), nil, f )
125
- end
133
+ end
134
+ @inside_gemfile = false
126
135
  end
127
136
 
128
137
  if @gemspec_args
129
- @inside_gemfile = :gemfile
130
138
  case @gemspec_args[ 0 ]
131
139
  when Hash
132
140
  gemspec( @gemspec_args[ 0 ].merge( options ) )
@@ -140,25 +148,24 @@ module Maven
140
148
  setup_gem_support( options )
141
149
  end
142
150
 
143
- if pr.dependencies.empty?
151
+ if pr && pr.dependencies.empty?
144
152
  @current.profiles.delete( pr )
145
153
  end
146
154
 
147
- lockfile = ::File.expand_path( name + '.lock' )
148
- if File.exists? lockfile
155
+ if pr && !pr.dependencies.empty?
149
156
  profile :gemfile_lock do
150
157
  activation do
151
158
  file( :exists => name + '.lock' )
152
159
  end
153
160
  locked = GemfileLock.new( lockfile )
154
- locked.hull.each do |name, version|
155
- gem name, version unless model.artifact_id == name && model.group_id == 'rubygems'
156
- end
161
+ add_scoped_hull( locked, pr.dependencies )
162
+ add_scoped_hull( locked, pr.dependencies, :provided )
163
+ add_scoped_hull( locked, pr.dependencies, :test )
157
164
  end
158
165
  end
159
166
 
160
167
  if @has_path or @has_git
161
- gem 'bundler', :scope => :provided unless gem? 'bundler'
168
+ gem 'bundler', VERSIONS[ :bundler_version ], :scope => :provided unless gem? 'bundler'
162
169
  jruby_plugin :gem do
163
170
  execute_goal :exec, :filename => 'bundle', :args => 'install'
164
171
  end
@@ -170,7 +177,25 @@ module Maven
170
177
  @has_git = nil
171
178
  end
172
179
 
180
+ def add_scoped_hull( locked, deps, scope = nil )
181
+ options = {}
182
+ options[ :scope ] = scope if scope
183
+ scope ||= "compile runtime default"
184
+ scope = scope.to_s
185
+ names = deps.select do |d|
186
+ sc = d.scope || 'default'
187
+ scope.match /#{sc}/
188
+ end.collect { |d| d.artifact_id }
189
+ locked.dependency_hull( names ).each do |name, version|
190
+ gem name, version, options unless model.artifact_id == name && model.group_id == 'rubygems'
191
+ end
192
+ end
193
+ private :add_scoped_hull
194
+
173
195
  def setup_gem_support( options, spec = nil, config = {} )
196
+ unless model.properties.member?( 'project.build.sourceEncoding' )
197
+ properties( 'project.build.sourceEncoding' => 'utf-8' )
198
+ end
174
199
  if spec.nil?
175
200
  require_path = '.'
176
201
  name = ::File.basename( ::File.expand_path( '.' ) )
@@ -181,7 +206,8 @@ module Maven
181
206
 
182
207
  unless options[ :only_metadata ]
183
208
 
184
- unless model.repositories.detect { |r| r.id == 'rubygems-releases' }
209
+ if ( nil == model.repositories.detect { |r| r.id == 'rubygems-releases' } && options[ :no_rubygems_repo ] != true )
210
+
185
211
  repository( 'rubygems-releases',
186
212
  'http://rubygems-proxy.torquebox.org/releases' )
187
213
  end
@@ -208,7 +234,7 @@ module Maven
208
234
  end
209
235
  end
210
236
  if jar && ( source ||
211
- ::File.exists?( ::File.join( basedir, 'src', 'main', 'java' ) ) )
237
+ ::File.exists?( ::File.join( basedir, 'src', 'main', 'java' ) ) ) && spec.platform.to_s.match( /java|jruby/ )
212
238
  plugin( :jar, VERSIONS[ :jar_plugin ],
213
239
  :outputDirectory => output,
214
240
  :finalName => jar ) do
@@ -298,7 +324,7 @@ module Maven
298
324
  spec_file = ::File.read( f )
299
325
  begin
300
326
  spec = Gem::Specification.from_yaml( spec_file )
301
- rescue Gem::Exception
327
+ rescue
302
328
  FileUtils.cd( basedir ) do
303
329
  # TODO jruby java user.dir
304
330
  spec = eval( spec_file, nil, f )
@@ -310,20 +336,30 @@ module Maven
310
336
 
311
337
  def spec( spec, name = nil, options = {} )
312
338
  name ||= "#{spec.name}-#{spec.version}.gemspec"
313
- unless model.properties.member?( 'project.build.sourceEncoding' )
314
- properties( 'project.build.sourceEncoding' => 'utf-8' )
315
- end
316
339
 
317
340
  @gemfile_options = nil
318
341
 
319
342
  if @context == :project
320
343
  build.directory = '${basedir}/pkg'
321
344
  version = spec.version.to_s
322
- version += '-SNAPSHOT' if spec.version.prerelease?
345
+ if options[ :snapshot ] && spec.version.prerelease?
346
+ version += '-SNAPSHOT'
347
+ end
323
348
  id "rubygems:#{spec.name}:#{version}"
324
349
  name( spec.summary || spec.name )
325
350
  description spec.description
326
351
  url spec.homepage
352
+ if spec.homepage && spec.homepage.match( /github.com/ )
353
+ con = spec.homepage.sub( /http:/, 'https:' ).sub( /\/?$/, ".git" )
354
+ scm :url => spec.homepage, :connection => con
355
+ end
356
+
357
+ spec.licenses.each do |l|
358
+ license( l )
359
+ end
360
+ spec.authors.zip( spec.email || [] ).each do |d|
361
+ developer( :name => d[0], :email => d[1] )
362
+ end
327
363
  unless options[ :only_metadata ]
328
364
  packaging 'gem'
329
365
  extension 'de.saumya.mojo:gem-extension:${jruby.plugins.version}'
@@ -342,7 +378,7 @@ module Maven
342
378
  config )
343
379
 
344
380
  deps = nil
345
- if @inside_gemfile
381
+ if @inside_gemfile.is_a? Symbol
346
382
  profile! @inside_gemfile do
347
383
  deps = all_deps( spec )
348
384
  end
@@ -454,6 +490,7 @@ module Maven
454
490
  issues = IssueManagement.new
455
491
  args, options = args_and_options( *args )
456
492
  issues.url = args[ 0 ]
493
+ issues.system = args[ 1 ]
457
494
  fill_options( issues, options )
458
495
  nested_block( :issue_management, issues, block ) if block
459
496
  @current.issue_management = issues
@@ -502,6 +539,7 @@ module Maven
502
539
  @current.notifiers << n
503
540
  n
504
541
  end
542
+
505
543
  def mailing_list( *args, &block )
506
544
  list = MailingList.new
507
545
  args, options = args_and_options( *args )
@@ -600,7 +638,7 @@ module Maven
600
638
  def test_resource( options = {}, &block )
601
639
  # strange behaviour when calling specs from Rakefile
602
640
  return if @current.nil?
603
- resource = TestResource.new
641
+ resource = Resource.new
604
642
  fill_options( resource, options )
605
643
  nested_block( :test_resource, resource, block ) if block
606
644
  if @context == :project
@@ -677,6 +715,10 @@ module Maven
677
715
  rp
678
716
  end
679
717
 
718
+ def enabled( value )
719
+ @current.enabled = ( value.to_s == 'true' )
720
+ end
721
+
680
722
  def args_and_options( *args )
681
723
  if args.last.is_a? Hash
682
724
  [ args[0..-2], args.last ]
@@ -736,7 +778,7 @@ module Maven
736
778
 
737
779
  def exclusion( *gav )
738
780
  gav = gav.join( ':' )
739
- ex = fill_gav( Extension, gav)
781
+ ex = fill_gav( Exclusion, gav )
740
782
  @current.exclusions << ex
741
783
  ex
742
784
  end
@@ -803,7 +845,12 @@ module Maven
803
845
  @current.build.plugins
804
846
  end
805
847
  else
806
- @current.plugins
848
+ if @context == :overrides
849
+ @current.plugin_management ||= PluginManagement.new
850
+ @current.plugin_management.plugins
851
+ else
852
+ @current.plugins
853
+ end
807
854
  end
808
855
  end
809
856
  private :plugins
@@ -857,12 +904,13 @@ module Maven
857
904
 
858
905
  # hook for polyglot maven to register those tasks
859
906
  def add_execute_task( options, &block )
907
+ @model.properties[ 'tesla.version' ] = VERSIONS[ :tesla_version ]
860
908
  plugin!( 'io.tesla.polyglot:tesla-polyglot-maven-plugin',
861
- VERSIONS[ :tesla_version ] ) do
909
+ '${tesla.version}' ) do
862
910
  execute_goal( :execute, options )
863
911
 
864
912
  jar!( 'io.tesla.polyglot:tesla-polyglot-ruby',
865
- VERSIONS[ :tesla_version ] )
913
+ '${tesla.version}' )
866
914
  end
867
915
  end
868
916
 
@@ -1029,10 +1077,14 @@ module Maven
1029
1077
  end
1030
1078
  end
1031
1079
 
1032
- def phase( name )
1033
- @phase = name
1034
- yield
1035
- @phase = nil
1080
+ def phase( name, &block )
1081
+ if @context != :plugin && block
1082
+ @phase = name
1083
+ yield
1084
+ @phase = nil
1085
+ else
1086
+ @current.phase = name
1087
+ end
1036
1088
  end
1037
1089
 
1038
1090
  def profile!( id, &block )
@@ -1103,7 +1155,11 @@ module Maven
1103
1155
  end
1104
1156
  if args.last.is_a?(Hash)
1105
1157
  options = args.last
1106
-
1158
+ elsif @group
1159
+ options = {}
1160
+ args << options
1161
+ end
1162
+ if options
1107
1163
  # on ruby-maven side we ignore the require option
1108
1164
  options.delete( :require )
1109
1165
  options.delete( 'require' )
@@ -1114,15 +1170,15 @@ module Maven
1114
1170
  @has_path = true
1115
1171
  else
1116
1172
  platform = options.delete( :platform ) || options.delete( 'platform' )
1117
- group = options.delete( :group ) || options.delete( 'group' ) || @group || nil
1118
- if group
1173
+ group = options.delete( :group ) || options.delete( 'group' ) || @group
1174
+ if group
1119
1175
  case group.to_sym
1120
1176
  when :test
1121
1177
  options[ :scope ] = :test
1122
1178
  when :development
1123
1179
  options[ :scope ] = :provided
1124
1180
  end
1125
- end
1181
+ end
1126
1182
  if platform.nil? || is_jruby_platform( platform )
1127
1183
  options[ :version ] = '[0,)' if args.size == 2 && options[ :version ].nil? && options[ 'version' ].nil?
1128
1184
  do_dependency( bang, :gem, *args )
@@ -1202,13 +1258,31 @@ module Maven
1202
1258
  end
1203
1259
 
1204
1260
  def xml( xml )
1205
- raise 'Xpp3DomBuilder.build( java.io.StringReader.new( xml ) )'
1261
+ def xml.to_xml
1262
+ self
1263
+ end
1264
+ xml
1206
1265
  end
1207
1266
 
1208
- def set_config( receiver, options )
1267
+ def prepare_config( receiver, options )
1268
+ return unless options
1269
+ inherited = options.delete( 'inherited' ) || options.delete( :inherited )
1270
+ receiver.inherited = inherited if inherited
1271
+ end
1272
+
1273
+ def set_config( receiver, options )
1274
+ prepare_config( receiver, options )
1209
1275
  receiver.configuration = options
1210
1276
  end
1211
1277
 
1278
+ def configuration( v )
1279
+ if @context == :notifier
1280
+ @current.configuration = v
1281
+ else
1282
+ set_config( @current, v )
1283
+ end
1284
+ end
1285
+
1212
1286
  private
1213
1287
 
1214
1288
  def do_repository( method, *args, &block )
@@ -2,367 +2,369 @@ require 'virtus'
2
2
 
3
3
  module Maven
4
4
  module Tools
5
- class Base
5
+ Base = Virtus.model
6
+
7
+ module GAV
8
+ def self.included( base )
9
+ base.attribute :group_id, String
10
+ base.attribute :artifact_id, String
11
+ base.attribute :version, String
12
+ end
13
+ end
14
+ module GA
15
+ def self.included( base )
16
+ base.attribute :group_id, String
17
+ base.attribute :artifact_id, String
18
+ end
19
+ end
20
+ module SU
21
+ def self.included( base )
22
+ base.attribute :system, String
23
+ base.attribute :url, String
24
+ end
25
+ end
26
+ module NU
27
+ def self.included( base )
28
+ base.attribute :name, String
29
+ base.attribute :url, String
30
+ end
31
+ end
32
+ module INU
33
+ def self.included( base )
34
+ base.attribute :id, String
35
+ base.attribute :name, String
36
+ base.attribute :url, String
37
+ end
6
38
  end
7
39
 
8
- module GAV
9
- def self.included( base )
10
- base.attribute :group_id, String
11
- base.attribute :artifact_id, String
12
- base.attribute :version, String
13
- end
14
- end
15
- module GA
16
- def self.included( base )
17
- base.attribute :group_id, String
18
- base.attribute :artifact_id, String
19
- end
20
- end
21
- module SU
22
- def self.included( base )
23
- base.attribute :system, String
24
- base.attribute :url, String
25
- end
26
- end
27
- module NU
28
- def self.included( base )
29
- base.attribute :name, String
30
- base.attribute :url, String
31
- end
32
- end
33
- module INU
34
- def self.included( base )
35
- base.attribute :id, String
36
- base.attribute :name, String
37
- base.attribute :url, String
38
- end
39
- end
40
-
41
- class Parent < Base
42
- include Virtus.model
43
-
44
- include GAV
40
+ class Parent
41
+ include Base
45
42
 
46
- attribute :relative_path, String
47
- end
48
- class Organization < Base
49
- include Virtus.model
43
+ include GAV
50
44
 
51
- include NU
52
- end
53
- class License < Base
54
- include Virtus.model
55
-
56
- include NU
57
- attribute :distribution, String
58
- attribute :comments, String
59
- end
60
- class Developer < Base
61
- include Virtus.model
62
-
63
- include INU
64
- attribute :email, String
65
- attribute :organization, String
66
- attribute :organization_url, String
67
- attribute :roles, String
68
- attribute :timezone, String
69
- attribute :properties, Hash
70
- end
71
- class Contributor < Base
72
- include Virtus.model
73
-
74
- include NU
75
- attribute :email, String
76
- attribute :organization, String
77
- attribute :organization_url, String
78
- attribute :roles, String
79
- attribute :timezone, String
80
- attribute :properties, Hash
81
- end
82
- class MailingList < Base
83
- include Virtus.model
84
-
85
- attribute :name, String
86
- attribute :subscribe, String
87
- attribute :unsubscribe, String
88
- attribute :post, String
89
- attribute :archive, String
90
- attribute :other_archives, Array[ String ]
91
- end
92
- class Prerequisites < Base
93
- include Virtus.model
45
+ attribute :relative_path, String
46
+ end
47
+ class Organization
48
+ include Base
94
49
 
95
- attribute :maven, String
96
- end
97
- class Scm < Base
98
- include Virtus.model
50
+ include NU
51
+ end
52
+ class License
53
+ include Base
99
54
 
100
- attribute :connection, String
101
- attribute :developer_connection, String
102
- attribute :tag, String
103
- attribute :url, String
104
- end
105
- class IssueManagement < Base
106
- include Virtus.model
55
+ include NU
56
+ attribute :distribution, String
57
+ attribute :comments, String
58
+ end
59
+ class Developer
60
+ include Base
61
+
62
+ include INU
63
+ attribute :email, String
64
+ attribute :organization, String
65
+ attribute :organization_url, String
66
+ attribute :roles, String
67
+ attribute :timezone, String
68
+ attribute :properties, Hash
69
+ end
70
+ class Contributor
71
+ include Base
72
+
73
+ include NU
74
+ attribute :email, String
75
+ attribute :organization, String
76
+ attribute :organization_url, String
77
+ attribute :roles, String
78
+ attribute :timezone, String
79
+ attribute :properties, Hash
80
+ end
81
+ class MailingList
82
+ include Base
83
+
84
+ attribute :name, String
85
+ attribute :subscribe, String
86
+ attribute :unsubscribe, String
87
+ attribute :post, String
88
+ attribute :archive, String
89
+ attribute :other_archives, Array[ String ]
90
+
91
+ def archives=( archives )
92
+ self.archive = archives.shift
93
+ self.other_archives = archives
94
+ end
95
+ end
96
+ class Prerequisites
97
+ include Base
107
98
 
108
- include SU
109
- end
110
- class Notifier < Base
111
- include Virtus.model
112
-
113
- attribute :type, String
114
- attribute :send_on_error, Boolean
115
- attribute :send_on_failure, Boolean
116
- attribute :send_on_success, Boolean
117
- attribute :send_on_warning, Boolean
118
- attribute :address, String
119
- attribute :configuration, Hash
120
- end
121
- class CiManagement < Base
122
- include Virtus.model
99
+ attribute :maven, String
100
+ end
101
+ class Scm
102
+ include Base
123
103
 
124
- include SU
125
-
126
- attribute :notifiers, Array[ Notifier ]
127
- end
128
- class Site < Base
129
- include Virtus.model
104
+ attribute :connection, String
105
+ attribute :developer_connection, String
106
+ attribute :tag, String
107
+ attribute :url, String
108
+ end
109
+ class IssueManagement
110
+ include Base
130
111
 
131
- include INU
132
- end
133
- class Relocation < Base
134
- include Virtus.model
112
+ include SU
113
+ end
114
+ class Notifier
115
+ include Base
116
+
117
+ attribute :type, String
118
+ attribute :send_on_error, Boolean
119
+ attribute :send_on_failure, Boolean
120
+ attribute :send_on_success, Boolean
121
+ attribute :send_on_warning, Boolean
122
+ attribute :address, String
123
+ attribute :configuration, Hash
124
+ end
125
+ class CiManagement
126
+ include Base
135
127
 
136
- include GAV
137
- attribute :message, String
138
- end
139
- class RepositoryPolicy < Base
140
- include Virtus.model
128
+ include SU
129
+
130
+ attribute :notifiers, Array[ Notifier ]
131
+ end
132
+ class Site
133
+ include Base
141
134
 
142
- attribute :enabled, Boolean
143
- attribute :update_policy, String
144
- attribute :checksum_policy, String
145
- end
146
- class Repository < Base
147
- include Virtus.model
135
+ include INU
136
+ end
137
+ class Relocation
138
+ include Base
148
139
 
149
- attribute :unique_version, String
150
- attribute :releases, RepositoryPolicy
151
- attribute :snapshots, RepositoryPolicy
140
+ include GAV
141
+ attribute :message, String
142
+ end
143
+ class RepositoryPolicy
144
+ include Base
152
145
 
153
- include INU
146
+ attribute :enabled, Boolean
147
+ attribute :update_policy, String
148
+ attribute :checksum_policy, String
149
+ end
150
+ class Repository
151
+ include Base
154
152
 
155
- attribute :layout, String
156
- end
157
- class PluginRepository < Repository; end
158
- class DeploymentRepository < Repository; end
159
- class DistributionManagement < Base
160
- include Virtus.model
161
-
162
- attribute :repository, Repository
163
- attribute :snapshot_repository, Repository
164
- attribute :site, Site
165
- attribute :download_url, String
166
- attribute :status, String
167
- attribute :relocation, Relocation
168
- end
169
- class Exclusion < Base
170
- include Virtus.model
153
+ attribute :releases, RepositoryPolicy
154
+ attribute :snapshots, RepositoryPolicy
171
155
 
172
- include GA
173
- end
174
- class Dependency < Base
175
- include Virtus.model
156
+ include INU
176
157
 
177
- include GAV
158
+ attribute :layout, String
159
+ end
160
+ class PluginRepository < Repository; end
161
+ class DeploymentRepository < Repository; end
162
+ class DistributionManagement
163
+ include Base
164
+
165
+ attribute :repository, Repository
166
+ attribute :snapshot_repository, Repository
167
+ attribute :site, Site
168
+ attribute :download_url, String
169
+ attribute :status, String
170
+ attribute :relocation, Relocation
171
+ end
172
+ class Exclusion
173
+ include Base
178
174
 
179
- attribute :type, String
180
- attribute :classifier, String
181
- attribute :scope, String
182
- attribute :system_path, String
183
- attribute :exclusions, Array[ Exclusion ]
184
- attribute :optional, Boolean
175
+ include GA
176
+ end
177
+ class Dependency
178
+ include Base
179
+
180
+ include GAV
181
+
182
+ attribute :type, String
183
+ attribute :classifier, String
184
+ attribute :scope, String
185
+ attribute :system_path, String
186
+ attribute :exclusions, Array[ Exclusion ]
187
+ attribute :optional, Boolean
188
+
189
+ # silent default
190
+ def type=( t )
191
+ if t.to_sym == :jar
192
+ @type = nil
193
+ else
194
+ @type = t
195
+ end
196
+ end
197
+ end
198
+ class DependencyManagement
199
+ include Base
185
200
 
186
- # silent default
187
- def type=( t )
188
- if t.to_sym == :jar
189
- @type = nil
190
- else
191
- @type = t
201
+ attribute :dependencies, Array[ Dependency ]
192
202
  end
193
- end
194
- end
195
- class DependencyManagement < Base
196
- include Virtus.model
203
+ class Extension
204
+ include Base
197
205
 
198
- attribute :dependencies, Array[ Dependency ]
199
- end
200
- class Extension < Base
201
- include Virtus.model
206
+ include GAV
207
+ end
208
+ class Resource
209
+ include Base
210
+
211
+ attribute :target_path, String
212
+ attribute :filtering, String
213
+ attribute :directory, String
214
+ attribute :includes, Array[ String ]
215
+ attribute :excludes, Array[ String ]
216
+ end
217
+ class Execution
218
+ include Base
219
+
220
+ attribute :id, String
221
+ attribute :phase, String
222
+ attribute :goals, Array[ String ]
223
+ attribute :inherited, Boolean
224
+ attribute :configuration, Hash
225
+ end
226
+ class Plugin
227
+ include Base
228
+
229
+ include GAV
230
+ attribute :extensions, Boolean
231
+ attribute :executions, Array[ Execution ]
232
+ attribute :dependencies, Array[ Dependency ]
233
+ attribute :goals, Array[ String ]
234
+ attribute :inherited, Boolean
235
+ attribute :configuration, Hash
236
+
237
+ # silent default
238
+ def group_id=( v )
239
+ if v.to_s == 'org.apache.maven.plugins'
240
+ @group_id = nil
241
+ else
242
+ @group_id = v
243
+ end
244
+ end
245
+ end
246
+ class PluginManagement
247
+ include Base
202
248
 
203
- include GAV
204
- end
205
- class Resource < Base
206
- include Virtus.model
207
-
208
- attribute :target_path, String
209
- attribute :filtering, String
210
- attribute :directory, String
211
- attribute :includes, Array[ String ]
212
- attribute :excludes, Array[ String ]
213
- end
214
- class Execution < Base
215
- include Virtus.model
216
-
217
- attribute :id, String
218
- attribute :phase, String
219
- attribute :goals, Array[ String ]
220
- attribute :inherited, Boolean
221
- attribute :configuration, Hash
222
- end
223
- class Plugin < Base
224
- include Virtus.model
225
-
226
- include GAV
227
- attribute :extensions, Boolean
228
- attribute :executions, Array[ Execution ]
229
- attribute :dependencies, Array[ Dependency ]
230
- attribute :goals, Array[ String ]
231
- attribute :inherited, Boolean
232
- attribute :configuration, Hash
233
-
234
- # silent default
235
- def group_id=( v )
236
- if v.to_s == 'org.apache.maven.plugins'
237
- @group_id = nil
238
- else
239
- @group_id = v
249
+ attribute :plugins, Array[ Plugin ]
240
250
  end
241
- end
242
- end
243
- class PluginManagement < Base
244
- include Virtus.model
251
+ class ReportSet
252
+ include Base
245
253
 
246
- attribute :plugins, Array[ Plugin ]
247
- end
248
- class TestResource < Resource; end
249
- class ReportSet < Base
250
- include Virtus.model
251
-
252
- attribute :id, String
253
- attribute :reports, Array[ String ]
254
- attribute :inherited, Boolean
255
- attribute :configuration, Hash
256
- end
257
- class ReportPlugin < Base
258
- include Virtus.model
254
+ attribute :id, String
255
+ attribute :reports, Array[ String ]
256
+ attribute :inherited, Boolean
257
+ attribute :configuration, Hash
258
+ end
259
+ class ReportPlugin
260
+ include Base
259
261
 
260
- include GAV
262
+ include GAV
261
263
 
262
- attribute :report_sets, Array[ ReportSet ]
263
- end
264
- class Reporting < Base
265
- include Virtus.model
264
+ attribute :report_sets, Array[ ReportSet ]
265
+ end
266
+ class Reporting
267
+ include Base
266
268
 
267
- attribute :exclude_defaults, Boolean
268
- attribute :output_directory, String
269
- attribute :plugins, Array[ ReportPlugin ]
270
- end
271
- class Build < Base
272
- include Virtus.model
273
-
274
- attribute :source_directory, String
275
- attribute :script_source_directory, String
276
- attribute :test_source_directory, String
277
- attribute :output_directory, String
278
- attribute :test_output_directory, String
279
- attribute :extensions, Array[ Extension ]
280
- attribute :default_goal, String
281
- attribute :resources, Array[ Resource ]
282
- attribute :test_resources, Array[ TestResource ]
283
- attribute :directory, String
284
- attribute :final_name, String
285
- attribute :filters, Array[ String ]
286
- attribute :plugin_management, PluginManagement
287
- attribute :plugins, Array[ Plugin ]
288
- end
289
- class Os < Base
290
- include Virtus.model
269
+ attribute :exclude_defaults, Boolean
270
+ attribute :output_directory, String
271
+ attribute :plugins, Array[ ReportPlugin ]
272
+ end
273
+ class Build
274
+ include Base
275
+
276
+ attribute :source_directory, String
277
+ attribute :script_source_directory, String
278
+ attribute :test_source_directory, String
279
+ attribute :output_directory, String
280
+ attribute :test_output_directory, String
281
+ attribute :extensions, Array[ Extension ]
282
+ attribute :default_goal, String
283
+ attribute :resources, Array[ Resource ]
284
+ attribute :test_resources, Array[ Resource ]
285
+ attribute :directory, String
286
+ attribute :final_name, String
287
+ attribute :filters, Array[ String ]
288
+ attribute :plugin_management, PluginManagement
289
+ attribute :plugins, Array[ Plugin ]
290
+ end
291
+ class Os
292
+ include Base
291
293
 
292
- attribute :name, String
293
- attribute :family, String
294
- attribute :arch, String
295
- attribute :version, String
296
- end
297
- class Property < Base
298
- include Virtus.model
294
+ attribute :name, String
295
+ attribute :family, String
296
+ attribute :arch, String
297
+ attribute :version, String
298
+ end
299
+ class Property
300
+ include Base
299
301
 
300
- attribute :name, String
301
- attribute :value, String
302
- end
303
- class ActivationFile < Base
304
- include Virtus.model
302
+ attribute :name, String
303
+ attribute :value, String
304
+ end
305
+ class ActivationFile
306
+ include Base
305
307
 
306
- attribute :missing, String
307
- attribute :exists, String
308
- end
309
- class Activation < Base
310
- include Virtus.model
311
-
312
- attribute :active_by_default, Boolean
313
- attribute :jdk, String
314
- attribute :os, Os
315
- attribute :property, Property
316
- attribute :file, ActivationFile
317
- end
318
- class Profile < Base
319
- include Virtus.model
320
-
321
- attribute :id, String
322
- attribute :activation, Activation
323
- attribute :build, Build
324
- attribute :modules, Array[ String ]
325
- attribute :distribution_management, DistributionManagement
326
- attribute :properties, Hash
327
- attribute :dependency_management, DependencyManagement
328
- attribute :dependencies, Array[ Dependency ]
329
- attribute :repositories, Array[ Repository ]
330
- attribute :plugin_repositories, Array[ PluginRepository ]
331
- attribute :reporting, Reporting
332
- end
333
- class Model < Base
334
- include Virtus.model
335
-
336
- attribute :model_version, String
337
- attribute :parent, Parent
338
-
339
- include GAV
340
-
341
- attribute :packaging, String
342
-
343
- include NU
344
-
345
- attribute :description, String
346
- attribute :inception_year, String
347
- attribute :organization, Organization
348
- attribute :licenses, Array[ License ]
349
- attribute :developers, Array[ Developer ]
350
- attribute :contributors, Array[ Contributor ]
351
- attribute :mailing_lists, Array[ MailingList ]
352
- attribute :prerequisites, Prerequisites
353
- attribute :modules, Array[ String ]
354
- attribute :scm, Scm
355
- attribute :issue_management, IssueManagement
356
- attribute :ci_management, CiManagement
357
- attribute :distribution_management, DistributionManagement
358
- attribute :properties, Hash
359
- attribute :dependency_management, DependencyManagement
360
- attribute :dependencies, Array[ Dependency ]
361
- attribute :repositories, Array[ Repository ]
362
- attribute :plugin_repositories, Array[ PluginRepository ]
363
- attribute :build, Build
364
- attribute :reporting, Reporting
365
- attribute :profiles, Array[ Profile ]
366
- end
367
- end
308
+ attribute :missing, String
309
+ attribute :exists, String
310
+ end
311
+ class Activation
312
+ include Base
313
+
314
+ attribute :active_by_default, Boolean
315
+ attribute :jdk, String
316
+ attribute :os, Os
317
+ attribute :property, Property
318
+ attribute :file, ActivationFile
319
+ end
320
+ class Profile
321
+ include Base
322
+
323
+ attribute :id, String
324
+ attribute :activation, Activation
325
+ attribute :build, Build
326
+ attribute :modules, Array[ String ]
327
+ attribute :distribution_management, DistributionManagement
328
+ attribute :properties, Hash
329
+ attribute :dependency_management, DependencyManagement
330
+ attribute :dependencies, Array[ Dependency ]
331
+ attribute :repositories, Array[ Repository ]
332
+ attribute :plugin_repositories, Array[ PluginRepository ]
333
+ attribute :reporting, Reporting
334
+ end
335
+ class Model
336
+ include Base
337
+
338
+ attribute :model_version, String
339
+ attribute :parent, Parent
340
+
341
+ include GAV
342
+
343
+ attribute :packaging, String
344
+
345
+ include NU
346
+
347
+ attribute :description, String
348
+ attribute :inception_year, String
349
+ attribute :organization, Organization
350
+ attribute :licenses, Array[ License ]
351
+ attribute :developers, Array[ Developer ]
352
+ attribute :contributors, Array[ Contributor ]
353
+ attribute :mailing_lists, Array[ MailingList ]
354
+ attribute :prerequisites, Prerequisites
355
+ attribute :modules, Array[ String ]
356
+ attribute :scm, Scm
357
+ attribute :issue_management, IssueManagement
358
+ attribute :ci_management, CiManagement
359
+ attribute :distribution_management, DistributionManagement
360
+ attribute :properties, Hash
361
+ attribute :dependency_management, DependencyManagement
362
+ attribute :dependencies, Array[ Dependency ]
363
+ attribute :repositories, Array[ Repository ]
364
+ attribute :plugin_repositories, Array[ PluginRepository ]
365
+ attribute :build, Build
366
+ attribute :reporting, Reporting
367
+ attribute :profiles, Array[ Profile ]
368
+ end
369
+ end
368
370
  end