ruby-maven 3.0.3.0.28.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/LICENSE.txt +202 -0
  2. data/NOTICE.txt +23 -0
  3. data/README.txt +77 -0
  4. data/bin/gwt +59 -0
  5. data/bin/jetty-run +25 -0
  6. data/bin/m2.conf +7 -0
  7. data/bin/mvn +172 -0
  8. data/bin/mvn.bat +197 -0
  9. data/bin/mvnDebug +177 -0
  10. data/bin/mvnDebug.bat +200 -0
  11. data/bin/mvnyjp +193 -0
  12. data/bin/rmvn +9 -0
  13. data/bin/tomcat-run +25 -0
  14. data/boot/plexus-classworlds-2.4.jar +0 -0
  15. data/conf/settings.xml +257 -0
  16. data/lib/aether-api-1.11.jar +0 -0
  17. data/lib/aether-connector-wagon-1.11.jar +0 -0
  18. data/lib/aether-impl-1.11.jar +0 -0
  19. data/lib/aether-spi-1.11.jar +0 -0
  20. data/lib/aether-util-1.11.jar +0 -0
  21. data/lib/commons-cli-1.2.jar +0 -0
  22. data/lib/ext/README.txt +2 -0
  23. data/lib/maven-aether-provider-3.0.3.jar +0 -0
  24. data/lib/maven-artifact-3.0.3.jar +0 -0
  25. data/lib/maven-compat-3.0.3.jar +0 -0
  26. data/lib/maven-core-3.0.3.jar +0 -0
  27. data/lib/maven-embedder-3.0.3.jar +0 -0
  28. data/lib/maven-model-3.0.3.jar +0 -0
  29. data/lib/maven-model-builder-3.0.3.jar +0 -0
  30. data/lib/maven-plugin-api-3.0.3.jar +0 -0
  31. data/lib/maven-repository-metadata-3.0.3.jar +0 -0
  32. data/lib/maven-settings-3.0.3.jar +0 -0
  33. data/lib/maven-settings-builder-3.0.3.jar +0 -0
  34. data/lib/nekohtml-1.9.6.2.jar +0 -0
  35. data/lib/plexus-cipher-1.4.jar +0 -0
  36. data/lib/plexus-component-annotations-1.5.5.jar +0 -0
  37. data/lib/plexus-interpolation-1.14.jar +0 -0
  38. data/lib/plexus-sec-dispatcher-1.3.jar +0 -0
  39. data/lib/plexus-utils-2.0.6.jar +0 -0
  40. data/lib/ruby/maven/model/dependencies.rb +281 -0
  41. data/lib/ruby/maven/model/model.rb +490 -0
  42. data/lib/ruby/maven/model/model_utils.rb +322 -0
  43. data/lib/ruby/maven/tools/execute_in_phase.rb +9 -0
  44. data/lib/ruby/maven/tools/gem_project.rb +387 -0
  45. data/lib/ruby/maven/tools/gemfile_lock.rb +67 -0
  46. data/lib/ruby/maven/tools/pom_generator.rb +61 -0
  47. data/lib/ruby/maven/tools/rails_project.rb +147 -0
  48. data/lib/ruby/maven/tools/versions.rb +11 -0
  49. data/lib/ruby/ruby_maven.rb +206 -0
  50. data/lib/sisu-guice-2.9.4-no_aop.jar +0 -0
  51. data/lib/sisu-inject-bean-2.1.1.jar +0 -0
  52. data/lib/sisu-inject-plexus-2.1.1.jar +0 -0
  53. data/lib/wagon-file-1.0-beta-7.jar +0 -0
  54. data/lib/wagon-http-lightweight-1.0-beta-7.jar +0 -0
  55. data/lib/wagon-http-shared-1.0-beta-7.jar +0 -0
  56. data/lib/wagon-provider-api-1.0-beta-7.jar +0 -0
  57. data/lib/xercesMinimal-1.9.6.2.jar +0 -0
  58. metadata +128 -0
@@ -0,0 +1,387 @@
1
+ require File.join(File.dirname(File.dirname(__FILE__)), 'model', 'model.rb')
2
+ require File.join(File.dirname(__FILE__), 'gemfile_lock.rb')
3
+ require File.join(File.dirname(__FILE__), 'versions.rb')
4
+
5
+ module Maven
6
+ module Tools
7
+ class GemProject < Maven::Model::Project
8
+ tags :dummy
9
+
10
+ def initialize(artifact_id = dir_name, version = "0.0.0", &block)
11
+ super("rubygems", artifact_id, version, &block)
12
+ packaging "gem"
13
+ end
14
+
15
+ def loaded_files
16
+ @files ||= []
17
+ end
18
+
19
+ def current_file
20
+ loaded_files.last
21
+ end
22
+
23
+ def dump_loaded_file_list
24
+ if loaded_files.size > 0
25
+ basedir = File.dirname(loaded_files[0])
26
+ File.open(loaded_files[0] + ".files", 'w') do |f|
27
+ loaded_files.each { |i| f.puts i.sub(/^#{basedir}./, '') }
28
+ end
29
+ end
30
+ end
31
+
32
+ def add_param(config, name, list, default = [])
33
+ if list.is_a? Array
34
+ config[name] = list.join(",").to_s unless (list || []) == default
35
+ else
36
+ # list == nil => (list || []) == default is true
37
+ config[name] = list.to_s unless (list || []) == default
38
+ end
39
+ end
40
+ private :add_param
41
+
42
+ def load_gemspec(specfile)
43
+ require 'rubygems'
44
+ if specfile.is_a? ::Gem::Specification
45
+ spec = specfile
46
+ else
47
+ spec = ::Gem::Specification.load(specfile)
48
+ loaded_files << File.expand_path(specfile)
49
+ end
50
+ raise "file not found '#{specfile}'" unless spec
51
+ @is_gemspec = loaded_files.size == 0
52
+ artifact_id spec.name
53
+ version spec.version
54
+ name spec.summary || "#{self.artifact_id} - gem"
55
+ description spec.description if spec.description
56
+ url spec.homepage if spec.homepage
57
+ (spec.email || []).zip(spec.authors || []).map do |email, author|
58
+ self.developers.new(author, email)
59
+ end
60
+
61
+ # TODO work with collection of licenses - there can be more than one !!!
62
+ (spec.licenses + spec.files.select {|file| file.to_s =~ /license|gpl/i }).each do |license|
63
+ # TODO make this better, i.e. detect the right license name from the file itself
64
+ self.licenses.new(license)
65
+ end
66
+
67
+ config = {}
68
+ add_param(config, "autorequire", spec.autorequire)
69
+ add_param(config, "defaultExecutable", spec.default_executable)
70
+ add_param(config, "testFiles", spec.test_files)
71
+ #has_rdoc always gives true => makes not sense to keep it then
72
+ #add_param(config, "hasRdoc", spec.has_rdoc)
73
+ add_param(config, "extraRdocFiles", spec.extra_rdoc_files)
74
+ add_param(config, "rdocOptions", spec.rdoc_options)
75
+ add_param(config, "requirePaths", spec.require_paths, ["lib"])
76
+ add_param(config, "rubyforgeProject", spec.rubyforge_project)
77
+ add_param(config, "requiredRubygemsVersion",
78
+ spec.required_rubygems_version && spec.required_rubygems_version != ">= 0" ? "<![CDATA[#{spec.required_rubygems_version}]]>" : nil)
79
+ add_param(config, "bindir", spec.bindir, "bin")
80
+ add_param(config, "requiredRubyVersion",
81
+ spec.required_ruby_version && spec.required_ruby_version != ">= 0" ? "<![CDATA[#{spec.required_ruby_version}]]>" : nil)
82
+ add_param(config, "postInstallMessage",
83
+ spec.post_install_message ? "<![CDATA[#{spec.post_install_message}]]>" : nil)
84
+ add_param(config, "executables", spec.executables)
85
+ add_param(config, "extensions", spec.extensions)
86
+ add_param(config, "platform", spec.platform, 'ruby')
87
+
88
+ # # TODO maybe calculate extra files
89
+ # files = spec.files.dup
90
+ # (Dir['lib/**/*'] + Dir['spec/**/*'] + Dir['features/**/*'] + Dir['test/**/*'] + spec.licenses + spec.extra_rdoc_files).each do |f|
91
+ # files.delete(f)
92
+ # if f =~ /^.\//
93
+ # files.delete(f.sub(/^.\//, ''))
94
+ # else
95
+ # files.delete("./#{f}")
96
+ # end
97
+ # end
98
+ #add_param(config, "extraFiles", files)
99
+ add_param(config, "files", spec.files)
100
+
101
+ plugin('gem').with(config) if config.size > 0
102
+
103
+ spec.dependencies.each do |dep|
104
+ scope =
105
+ case dep.type
106
+ when :runtime
107
+ "compile"
108
+ when :development
109
+ "test"
110
+ else
111
+ warn "unknown scope: #{dep.type}"
112
+ "compile"
113
+ end
114
+
115
+ versions = dep.requirement.requirements.collect do |req|
116
+ req.to_s
117
+ end
118
+ gem(dep.name, versions).scope = scope
119
+ end
120
+
121
+ spec.requirements.each do |req|
122
+ begin
123
+ eval req
124
+ rescue => e
125
+ # TODO requirements is a list !!!
126
+ add_param(config, "requirements", req)
127
+ warn e
128
+ rescue SyntaxError => e
129
+ # TODO requirements is a list !!!
130
+ add_param(config, "requirements", req)
131
+ end
132
+ end
133
+ end
134
+
135
+ def load(file)
136
+ file = file.path if file.is_a?(File)
137
+ if File.exists? file
138
+ content = File.read(file)
139
+ loaded_files << file
140
+ if @lock.nil?
141
+ @lock = GemfileLock.new(file + ".lock")
142
+ if @lock.size == 0
143
+ @lock = nil
144
+ else
145
+ loaded_files << file + ".lock"
146
+ @lock.hull.each do |dep|
147
+ dependency_management.gem dep
148
+ end
149
+ end
150
+ end
151
+ eval content
152
+ else
153
+ self
154
+ end
155
+ end
156
+
157
+ def dir_name
158
+ File.basename(File.expand_path("."))
159
+ end
160
+ private :dir_name
161
+
162
+ def add_defaults(args = {})
163
+ versions = VERSIONS
164
+ versions = versions.merge(args) if args
165
+
166
+ name "#{dir_name} - gem" unless name
167
+
168
+ packaging "gem" unless packaging
169
+
170
+ repository("rubygems-releases").url = "http://rubygems-proxy.torquebox.org/releases" unless repository("rubygems-releases").url
171
+
172
+ has_prerelease = dependencies.detect { |d| d.type.to_sym == :gem && d.version =~ /[a-zA-Z]/ }
173
+
174
+ repository("rubygems-prereleases").url = "http://rubygems-proxy.torquebox.org/prereleases" if has_prerelease && !repository("rubygems-prereleases").url
175
+
176
+ if !jar?("org.jruby:jruby-complete") && !jar?("org.jruby:jruby-core") && versions[:jruby_version]
177
+ minor = versions[:jruby_version].sub(/[0-9]*\./, '').sub(/\..*/, '')
178
+
179
+ #TODO once jruby-core pom is working !!!
180
+ if minor.to_i > 55 #TODO fix minor minimum version
181
+ jar("org.jruby:jruby-core", versions[:jruby_version])
182
+ jar("org.jruby:jruby-stdlib", versions[:jruby_version])
183
+ # override deps which works
184
+ jar("jline:jline", '0.9.94') if versions[:jruby_version] =~ /1.6.[1-2]/
185
+ jar("org.jruby.extras:jffi", '1.0.8', 'native') if versions[:jruby_version] =~ /1.6.[0-2]/
186
+ jar("org.jruby.extras:jaffl", '0.5.10') if versions[:jruby_version] =~ /1.6.[0-2]/
187
+ else
188
+ jar("org.jruby:jruby-complete", versions[:jruby_version])
189
+ end
190
+ end
191
+
192
+ # TODO go through all plugins to find out any SNAPSHOT version !!
193
+ if versions[:jruby_plugins] =~ /-SNAPSHOT$/ || properties['jruby.plugins.version'] =~ /-SNAPSHOT$/
194
+ plugin_repository("sonatype-snapshots") do |nexus|
195
+ nexus.url = "http://oss.sonatype.org/content/repositories/snapshots"
196
+ nexus.releases(:enabled => false)
197
+ nexus.snapshots(:enabled => true)
198
+ end
199
+ end
200
+
201
+ if packaging =~ /gem/ || plugin?(:gem)
202
+ gem = plugin(:gem)
203
+ gem.version = "${jruby.plugins.version}" unless gem.version
204
+ gem.extensions = true if packaging =~ /gem/
205
+ end
206
+
207
+ if plugin?(:bundler)
208
+ plugin_repository("rubygems-releases").url = "http://rubygems-proxy.torquebox.org/releases" unless plugin_repository("rubygems-releases").url
209
+ bundler = plugin(:bundler)
210
+ bundler.version = "${jruby.plugins.version}" unless bundler.version
211
+ bundler.executions.goals << "install"
212
+ unless gem?(:bundler)
213
+ gem("bundler")
214
+ end
215
+ end
216
+
217
+ if versions[:jruby_plugins]
218
+ #add_test_plugin(nil, "test")
219
+ add_test_plugin("rspec", "spec")
220
+ add_test_plugin("cucumber", "features")
221
+ end
222
+
223
+ self.properties = {
224
+ "project.build.sourceEncoding" => "UTF-8",
225
+ "gem.home" => "${project.build.directory}/rubygems",
226
+ "gem.path" => "${project.build.directory}/rubygems",
227
+ "jruby.plugins.version" => versions[:jruby_plugins]
228
+ }.merge(self.properties)
229
+ end
230
+
231
+ def add_test_plugin(name, test_dir)
232
+ unless plugin?(name)
233
+ has_gem = name.nil? ? true : gem?(name)
234
+ if has_gem && File.exists?(test_dir)
235
+ plugin(name || 'runit', "${jruby.plugins.version}").execution.goals << "test"
236
+ end
237
+ else
238
+ pl = plugin(name || 'runit')
239
+ pl.version = "${jruby.plugins.version}" unless pl.version
240
+ end
241
+ end
242
+ private :add_test_plugin
243
+
244
+ def stack
245
+ @stack ||= [[:default]]
246
+ end
247
+ private :stack
248
+
249
+ def group(*args, &block)
250
+ stack << args
251
+ block.call if block
252
+ stack.pop
253
+ end
254
+
255
+ def gemspec(name = nil)
256
+ if name
257
+ load_gemspec(File.join(File.dirname(current_file), name))
258
+ else
259
+ Dir[File.join(File.dirname(current_file), "*.gemspec")].each do |file|
260
+ load_gemspec(file)
261
+ end
262
+ end
263
+ end
264
+
265
+ def source(*args)
266
+ warn "ignore source #{args}" if !(args[0].to_s =~ /^https?:\/\/rubygems.org/) && args[0] != :rubygems
267
+ end
268
+
269
+ def path(*args)
270
+ end
271
+
272
+ def git(*args)
273
+ end
274
+
275
+ def is_jruby_platform(*args)
276
+ args.detect { |a| :jruby == a.to_sym }
277
+ end
278
+ private :is_jruby_platform
279
+
280
+ def platforms(*args, &block)
281
+ if is_jruby_platform(*args)
282
+ block.call
283
+ end
284
+ end
285
+
286
+ def gem(*args, &block)
287
+ dep = nil
288
+ if args.last.is_a?(Hash)
289
+ options = args.delete(args.last)
290
+ unless options.key?(:git) || options.key?(:path)
291
+ if options[:platforms].nil? || is_jruby_platform(*(options[:platforms] || []))
292
+ group = options[:group] || options[:groups]
293
+ if group
294
+ [group].flatten.each do |g|
295
+ if dep
296
+ profile(g).dependencies << dep
297
+ else
298
+ dep = profile(g).gem(args, &block)
299
+ end
300
+ end
301
+ else
302
+ self.gem(args, &block)
303
+ end
304
+ end
305
+ end
306
+ else
307
+ stack.last.each do |c|
308
+ if c == :default
309
+ if @lock.nil?
310
+ dep = add_gem(args, &block)
311
+ else
312
+ dep = add_gem(args[0], &block)
313
+
314
+ # add its dependencies as well to have the version
315
+ # determine by the dependencyManagement
316
+ @lock.dependency_hull(args[0]).map.each do |d|
317
+ add_gem d[0], nil
318
+ end
319
+ end
320
+ else
321
+ if @lock.nil?
322
+ if dep
323
+ profile(c).dependencies << dep
324
+ else
325
+ dep = profile(c).gem(args, &block)
326
+ end
327
+ else
328
+ if dep
329
+ profile(c).dependencies << dep
330
+ else
331
+ dep = profile(c).gem(args[0], nil, &block)
332
+ end
333
+ # add its dependencies as well to have the version
334
+ # determine by the dependencyManagement
335
+ @lock.dependency_hull(args[0]).map.each do |d|
336
+ profile(c).gem d[0], nil unless gem? d[0]
337
+ end
338
+ end
339
+ end
340
+ end
341
+ end
342
+ if dep && !@is_gemspec
343
+ project = self
344
+
345
+ # first collect the missing deps it any
346
+ bundler_deps = []
347
+ #plugin(:bundler) do |bundler|
348
+ # use a dep with version so just create it from the args
349
+ bundler_deps << args unless project.dependencies.member? dep
350
+
351
+ #TODO this should be done after all deps are in place - otherwise it depends on order how bundler gets setup
352
+ if @lock
353
+ # add its dependencies as well to have the version
354
+ # determine by the dependencyManagement
355
+ @lock.dependency_hull(dep.artifact_id).map.each do |d|
356
+ bundler_deps << d unless project.gem? d[0]
357
+ end
358
+ end
359
+ #end
360
+
361
+ # now add the deps to bundler plugin
362
+ # avoid to setup bundler if it has no deps
363
+ if bundler_deps.size > 0
364
+ plugin(:bundler) do |bundler|
365
+ bundler_deps.each do |d|
366
+ bundler.gem(d)
367
+ end
368
+ end
369
+ end
370
+ end
371
+ dep
372
+ end
373
+ end
374
+ end
375
+ end
376
+
377
+ if $0 == __FILE__
378
+ proj = Maven::Tools::GemProject.new("test_gem")
379
+ if ARGV[0] =~ /\.gemspec$/
380
+ proj.load_gemspec(ARGV[0])
381
+ else
382
+ proj.load(ARGV[0] || 'Gemfile')
383
+ end
384
+ proj.load(ARGV[1] || 'Mavenfile')
385
+ proj.add_defaults
386
+ puts proj.to_xml
387
+ end
@@ -0,0 +1,67 @@
1
+ module Maven
2
+ module Tools
3
+ class GemfileLock < Hash
4
+
5
+ class Dependency
6
+ attr_accessor :name, :version, :dependencies
7
+ def initialize(line, deps = {})
8
+ @name = line.sub(/\ .*/,'')
9
+ @version = line.sub(/.*\(/, '').sub(/\).*/, '').sub(/-java$/, '')
10
+ @dependencies = deps
11
+ end
12
+
13
+ def add(line)
14
+ dependencies[line.sub(/\ .*/,'')] = line.sub(/.*\(/, '').sub(/\).*/, '')
15
+ end
16
+ end
17
+
18
+ def initialize(file)
19
+ current = nil
20
+ f = file.is_a?(File) ? file.path: file
21
+ if File.exists? f
22
+ File.readlines(f).each do |line|
23
+ if line =~ /^ [^ ]/
24
+ line.strip!
25
+ current = Dependency.new(line)
26
+ self[current.name] = current
27
+ elsif line =~ /^ [^ ]/
28
+ line.strip!
29
+ current.add(line) if current
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ def recurse(result, dep)
36
+ result[dep] = self[dep].version if self[dep] && !result.key?(dep)
37
+ if d = self[dep]
38
+ d.dependencies.each do |name, version|
39
+ unless result.key? name
40
+ result[name] = self[name].nil?? version : self[name].version
41
+ recurse(result, name)
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ def dependency_hull(deps = [])
48
+ deps = deps.is_a?(Array) ? deps : [deps]
49
+ result = {}
50
+ deps.each do |dep|
51
+ recurse(result, dep)
52
+ end
53
+ result
54
+ end
55
+
56
+ def hull
57
+ dependency_hull(keys)
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ if $0 == __FILE__
64
+ lockfile = Maven::Tools::GemfileLock.new(File.new(ARGV[0] || 'Gemfile.lock'))
65
+ p lockfile
66
+ p lockfile.dependency_hull("rails")
67
+ end
@@ -0,0 +1,61 @@
1
+ require File.join(File.dirname(__FILE__), 'rails_project.rb')
2
+ module Maven
3
+ module Tools
4
+ class PomGenerator
5
+ def read_rails(filename, plugin_version = nil, jruby_version = nil)
6
+ proj = Maven::Tools::RailsProject.new
7
+ proj.load(filename.to_s)
8
+ proj.load(File.join(File.dirname(filename.to_s), 'Mavenfile'))
9
+ proj.add_defaults(versions(plugin_version, jruby_version))
10
+ proj.dump_loaded_file_list
11
+ proj.to_xml
12
+ end
13
+
14
+ def read_gemfile(filename, plugin_version = nil, jruby_version = nil)
15
+ dir = File.dirname(filename)
16
+ proj =
17
+ if File.exists? File.join( dir, 'config', 'application.rb' )
18
+ Maven::Tools::RailsProject.new
19
+ else
20
+ Maven::Tools::GemProject.new
21
+ end
22
+ proj.load(filename.to_s)
23
+ proj.load(File.join(File.dirname(filename.to_s), 'Mavenfile'))
24
+ proj.add_defaults(versions(plugin_version, jruby_version))
25
+ proj.dump_loaded_file_list
26
+ proj.to_xml
27
+ end
28
+
29
+ def read_gemspec(filename, plugin_version = nil, jruby_version = nil)
30
+ proj = Maven::Tools::GemProject.new
31
+ proj.load_gemspec(filename.to_s)
32
+ proj.load(File.join(File.dirname(filename.to_s), 'Mavenfile'))
33
+ proj.add_defaults(versions(plugin_version, jruby_version))
34
+ proj.dump_loaded_file_list
35
+ proj.to_xml
36
+ end
37
+
38
+ private
39
+
40
+ def versions(plugin_version, jruby_version)
41
+ result = {}
42
+ result[:jruby_plugins] = plugin_version if plugin_version
43
+ result[:jruby_version] = jruby_version if jruby_version
44
+ result
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ generator = Maven::Tools::PomGenerator.new
51
+
52
+ case ARGV.size
53
+ when 2
54
+ puts generator.send("read_#{ARGV[0]}".to_sym, ARGV[1])
55
+ when 3
56
+ puts generator.send("read_#{ARGV[0]}".to_sym, ARGV[1], ARGV[2])
57
+ when 4
58
+ puts generator.send("read_#{ARGV[0]}".to_sym, ARGV[1], ARGV[2], ARGV[3])
59
+ else
60
+ generator
61
+ end
@@ -0,0 +1,147 @@
1
+ require File.join(File.dirname(__FILE__), 'gem_project.rb')
2
+ module Maven
3
+ module Tools
4
+ class RailsProject < GemProject
5
+ tags :dummy
6
+
7
+ def initialize(name = dir_name, &block)
8
+ super(name, &block)
9
+ group_id "rails"
10
+ packaging "war"
11
+ end
12
+
13
+ def add_defaults(args = {})
14
+ self.name = "#{dir_name} - rails application" unless name
15
+
16
+ # setup bundler plugin
17
+ plugin(:bundler)
18
+
19
+ s_args = args.dup
20
+ s_args.delete(:jruby_plugins)
21
+ super(s_args)
22
+
23
+ versions = VERSIONS.merge(args)
24
+
25
+ rails_gem = dependencies.detect { |d| d.type.to_sym == :gem && d.artifact_id.to_s =~ /^rail.*s$/ } # allow rails or railties
26
+
27
+ if rails_gem && rails_gem.version =~ /^3.1./
28
+ versions[:jruby_rack] = '1.1.0.dev'
29
+ end
30
+
31
+ jar("org.jruby.rack:jruby-rack", versions[:jruby_rack]) unless jar?("org.jruby.rack:jruby-rack")
32
+
33
+ self.properties = {
34
+ "jetty.version" => versions[:jetty_plugin],
35
+ "rails.env" => "development",
36
+ "gem.includeRubygemsInTestResources" => false
37
+ }.merge(self.properties)
38
+
39
+ plugin(:rails3) do |rails|
40
+ rails.version = "${jruby.plugins.version}" unless rails.version
41
+ rails.in_phase(:validate).execute_goal(:initialize)#.goals << "initialize"
42
+ end
43
+
44
+ plugin(:war, versions[:war_plugin]) unless plugin?(:war)
45
+ plugin(:war).with({
46
+ :webResources => Maven::Model::NamedArray.new(:resource) do |l|
47
+ l << { :directory => "public" }
48
+ l << {
49
+ :directory => ".",
50
+ :targetPath => "WEB-INF",
51
+ :includes => ['app/**', 'config/**', 'lib/**', 'vendor/**', 'Gemfile']
52
+ }
53
+ l << {
54
+ :directory => '${gem.path}',
55
+ :targetPath => 'WEB-INF/gems',
56
+ :includes => ['gems/**', 'specifications/**']
57
+ }
58
+ l << {
59
+ :directory => '${gem.path}-bundler-maven-plugin',
60
+ :targetPath => 'WEB-INF/gems',
61
+ :includes => ['specifications/**']
62
+ }
63
+ end
64
+ })
65
+
66
+ profile(:development).activation.by_default
67
+ profile(:test).activation.property("rails.env", "test")
68
+ profile(:production) do |prod|
69
+ prod.activation.property("rails.env", "production")
70
+ prod.properties = {
71
+ "gem.home" => "${project.build.directory}/rubygems-production",
72
+ "gem.path" => "${project.build.directory}/rubygems-production"
73
+ }.merge(prod.properties)
74
+ end
75
+
76
+ profile(:war).plugin("org.mortbay.jetty:jetty-maven-plugin",
77
+ "${jetty.version}")
78
+
79
+ profile(:run) do |run|
80
+ overrideDescriptor = '${project.build.directory}/jetty/override-${rails.env}-web.xml'
81
+ run.activation.by_default
82
+ run.plugin("org.mortbay.jetty:jetty-maven-plugin",
83
+ "${jetty.version}").with({
84
+ :webAppConfig => {
85
+ :overrideDescriptor => overrideDescriptor
86
+ },
87
+ :connectors => <<-XML
88
+
89
+ <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
90
+ <port>8080</port>
91
+ </connector>
92
+ <connector implementation="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
93
+ <port>8443</port>
94
+ <keystore>${project.basedir}/src/test/resources/server.keystore</keystore>
95
+ <keyPassword>123456</keyPassword>
96
+ <password>123456</password>
97
+ </connector>
98
+ XML
99
+ })
100
+ end
101
+ profile(:executable) do |exec|
102
+ exec.plugin_repository('kos').url = 'http://opensource.kantega.no/nexus/content/groups/public/'
103
+ exec.plugin('org.simplericity.jettyconsole:jetty-console-maven-plugin', '1.42').execution do |jetty|
104
+ jetty.execute_goal(:createconsole)
105
+ jetty.configuration.comment <<-TEXT
106
+ see http://simplericity.com/2009/11/10/1257880778509.html for more info
107
+ -->
108
+ <!--
109
+ <backgroundImage>${basedir}/src/main/jettyconsole/puffin.jpg</backgroundImage>
110
+ <additionalDependencies>
111
+ <additionalDependency>
112
+ <artifactId>jetty-console-winsrv-plugin</artifactId>
113
+ </additionalDependency>
114
+ <additionalDependency>
115
+ <artifactId>jetty-console-requestlog-plugin</artifactId>
116
+ </additionalDependency>
117
+ <additionalDependency>
118
+ <artifactId>jetty-console-log4j-plugin</artifactId>
119
+ </additionalDependency>
120
+ <additionalDependency>
121
+ <artifactId>jetty-console-jettyxml-plugin</artifactId>
122
+ </additionalDependency>
123
+ <additionalDependency>
124
+ <artifactId>jetty-console-ajp-plugin</artifactId>
125
+ </additionalDependency>
126
+ <additionalDependency>
127
+ <artifactId>jetty-console-gzip-plugin</artifactId>
128
+ </additionalDependency>
129
+ <additionalDependency>
130
+ <artifactId>jetty-console-startstop-plugin</artifactId>
131
+ </additionalDependency>
132
+ </additionalDependencies>
133
+ TEXT
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+
141
+ if $0 == __FILE__
142
+ proj = Maven::Tools::RailsProject.new
143
+ proj.load(ARGV[0] || 'Gemfile')
144
+ proj.load(ARGV[1] || 'Mavenfile')
145
+ proj.add_defaults
146
+ puts proj.to_xml
147
+ end
@@ -0,0 +1,11 @@
1
+ module Maven
2
+ module Tools
3
+ VERSIONS = {
4
+ :jetty_plugin => "7.5.1.v20110908",
5
+ :jruby_rack => "1.0.10",
6
+ :war_plugin => "2.1.1",
7
+ :jruby_plugins => "0.28.4",
8
+ :jruby_version => "1.6.4",
9
+ }.freeze
10
+ end
11
+ end