buildr 1.4.4-x86-mswin32 → 1.4.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/CHANGELOG +46 -0
  2. data/Rakefile +0 -1
  3. data/addon/buildr/bnd.rb +147 -0
  4. data/addon/buildr/jaxb_xjc.rb +72 -0
  5. data/addon/buildr/protobuf.rb +14 -1
  6. data/buildr.gemspec +6 -2
  7. data/doc/artifacts.textile +6 -0
  8. data/doc/contributing.textile +3 -0
  9. data/doc/download.textile +60 -0
  10. data/doc/index.textile +9 -15
  11. data/doc/installing.textile +23 -6
  12. data/doc/mailing_lists.textile +4 -0
  13. data/doc/more_stuff.textile +333 -6
  14. data/doc/packaging.textile +187 -1
  15. data/lib/buildr.rb +8 -1
  16. data/lib/buildr/clojure.rb +34 -0
  17. data/lib/buildr/clojure/shell.rb +52 -0
  18. data/lib/buildr/core.rb +3 -0
  19. data/lib/buildr/core/#application.rb# +700 -0
  20. data/lib/buildr/core/application.rb +18 -8
  21. data/lib/buildr/core/build.rb +2 -2
  22. data/lib/buildr/core/cc.rb +57 -63
  23. data/lib/buildr/core/checks.rb +4 -5
  24. data/lib/buildr/core/doc.rb +3 -1
  25. data/lib/buildr/core/generate.rb +2 -0
  26. data/lib/buildr/core/jrebel.rb +42 -0
  27. data/lib/buildr/core/linux.rb +30 -0
  28. data/lib/buildr/core/project.rb +9 -8
  29. data/lib/buildr/core/run.rb +3 -3
  30. data/lib/buildr/core/shell.rb +29 -90
  31. data/lib/buildr/core/test.rb +3 -3
  32. data/lib/buildr/core/transports.rb +5 -5
  33. data/lib/buildr/core/util.rb +2 -2
  34. data/lib/buildr/groovy.rb +1 -0
  35. data/lib/buildr/groovy/compiler.rb +12 -1
  36. data/lib/buildr/groovy/doc.rb +76 -0
  37. data/lib/buildr/groovy/shell.rb +24 -15
  38. data/lib/buildr/ide.rb +1 -1
  39. data/lib/buildr/ide/idea.rb +527 -141
  40. data/lib/buildr/java/bdd.rb +18 -13
  41. data/lib/buildr/java/ecj.rb +1 -3
  42. data/lib/buildr/java/jtestr_result.rb +295 -0
  43. data/lib/buildr/java/jtestr_runner.rb.erb +4 -6
  44. data/lib/buildr/java/packaging.rb +14 -3
  45. data/lib/buildr/java/pom.rb +6 -2
  46. data/lib/buildr/java/test_result.rb +15 -243
  47. data/lib/buildr/java/tests.rb +1 -1
  48. data/lib/buildr/packaging.rb +2 -1
  49. data/lib/buildr/packaging/#package.rb.rej# +19 -0
  50. data/lib/buildr/packaging/archive.rb +13 -3
  51. data/lib/buildr/packaging/artifact.rb +11 -12
  52. data/lib/buildr/packaging/tar.rb +4 -1
  53. data/lib/buildr/packaging/zip.rb +106 -1
  54. data/lib/buildr/resources/completed.png +0 -0
  55. data/lib/buildr/resources/failed.png +0 -0
  56. data/lib/buildr/resources/icons-license.txt +17 -0
  57. data/lib/buildr/run.rb +7 -14
  58. data/lib/buildr/scala/#Untitled-2# +7 -0
  59. data/lib/buildr/scala/bdd.rb +1 -1
  60. data/lib/buildr/scala/compiler.rb +1 -1
  61. data/lib/buildr/scala/doc.rb +20 -2
  62. data/lib/buildr/scala/shell.rb +14 -22
  63. data/lib/buildr/scala/tests.rb +2 -2
  64. data/lib/buildr/shell.rb +113 -108
  65. data/lib/buildr/version.rb +1 -1
  66. data/rakelib/checks.rake +9 -7
  67. data/rakelib/doc.rake +10 -0
  68. data/rakelib/release.rake +9 -0
  69. data/rakelib/rspec.rake +27 -28
  70. data/rakelib/setup.rake +1 -1
  71. data/rakelib/stage.rake +2 -2
  72. data/spec/addon/bnd_spec.rb +330 -0
  73. data/spec/addon/jaxb_xjc_spec.rb +125 -0
  74. data/spec/core/application_spec.rb +1 -1
  75. data/spec/core/build_spec.rb +7 -7
  76. data/spec/core/cc_spec.rb +154 -104
  77. data/spec/core/compile_spec.rb +3 -3
  78. data/spec/core/project_spec.rb +10 -0
  79. data/spec/core/run_spec.rb +1 -0
  80. data/spec/core/shell_spec.rb +146 -0
  81. data/spec/groovy/doc_spec.rb +65 -0
  82. data/spec/ide/eclipse_spec.rb +1 -1
  83. data/spec/ide/idea_spec.rb +1145 -0
  84. data/spec/java/bdd_spec.rb +3 -3
  85. data/spec/java/emma_spec.rb +2 -0
  86. data/spec/java/packaging_spec.rb +40 -11
  87. data/spec/java/test_coverage_helper.rb +1 -1
  88. data/spec/packaging/archive_spec.rb +76 -21
  89. data/spec/packaging/artifact_namespace_spec.rb +1 -1
  90. data/spec/packaging/artifact_spec.rb +14 -7
  91. data/spec/sandbox.rb +11 -4
  92. data/spec/scala/bdd_spec.rb +2 -2
  93. data/spec/scala/compiler_spec.rb +2 -2
  94. data/spec/scala/doc_spec.rb +24 -4
  95. data/spec/scala/scala.rb +2 -2
  96. data/spec/scala/tests_spec.rb +2 -2
  97. data/spec/spec_helpers.rb +9 -8
  98. data/spec/xpath_matchers.rb +121 -0
  99. metadata +246 -166
  100. data/lib/buildr/ide/idea.ipr.template +0 -300
  101. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  102. data/lib/buildr/ide/idea7x.rb +0 -231
  103. data/spec/ide/idea7x_spec.rb +0 -96
@@ -22,8 +22,6 @@ h2(#linux). Installing on Linux
22
22
 
23
23
  *The easy way:* Use this bash script to "install Buildr on Linux":scripts/install-linux.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. It will also install Ruby 1.8.6 if not already installed (requires @apt-get@, @yum@ or @urpmi@) and upgrade to RubyGems 1.3.1 or later.
24
24
 
25
- p(note). At this time, the native Ruby-Java Bridge (RJB) does not work very well on Linux with JDK 1.6. If you get Segmentation Fault errors with JDK 1.6, we recommend switching to JDK 1.5.
26
-
27
25
  <br>
28
26
 
29
27
  *In details:* To get started you will need a recent version of Ruby, Ruby Gems and build tools for compiling native libraries (@make@, @gcc@ and standard headers).
@@ -41,7 +39,7 @@ On *Ubuntu* you have to install several packages:
41
39
  $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
42
40
  {% endhighlight %}
43
41
 
44
- The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
42
+ If using Ubuntu 9.10 or earlier, the Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
45
43
 
46
44
  {% highlight sh %}
47
45
  $ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
@@ -61,17 +59,26 @@ To upgrade to a new version or install a specific version:
61
59
 
62
60
  {% highlight sh %}
63
61
  $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
64
- $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
62
+ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.4.3
65
63
  {% endhighlight %}
66
64
 
67
65
 
68
-
69
66
  h2(#osx). Installing on OS X
70
67
 
71
68
  *The easy way:* Use this script to "install Buildr on OS X":scripts/install-osx.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. It will also install Ruby 1.8.6 if not already installed (using MacPorts/Fink) and upgrage RubyGems to 1.3.1 or later.
72
69
 
73
70
  You need to have the Apple Development Tools installed. They are available on the Mac OSX installation CD.
74
71
 
72
+ p(note). Java Update 3 for Snow Leopard removes header files necessary to compile the native Ruby-Java Bridge (RJB) gem, so installing rjb gem may fail on OS X. The solution is to install Java for Mac OS X 10.6 Update 3 Developer Package from http://connect.apple.com before @gem install@.
73
+
74
+ *Using RVM?* If you're not using the built-in ruby on OS X (e.g., if you're using RVM), you'll need to force-install the platform-independent RJB:
75
+
76
+ {% highlight sh %}
77
+ $ gem install rjb -v 1.3.3 --platform ruby
78
+ {% endhighlight %}
79
+
80
+ The darwin pre-built binary seems to only work with the built-in ruby.
81
+
75
82
  <br>
76
83
 
77
84
  *In details:* OS X 10.5 (Leopard) comes with a recent version of Ruby 1.8.6. You do not need to install a different version of Ruby when running OS X 10.5.
@@ -103,7 +110,6 @@ $ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
103
110
  $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
104
111
  {% endhighlight %}
105
112
 
106
-
107
113
  h2(#windows). Installing on Windows
108
114
 
109
115
  *The easy way:* The easiest way to install Ruby is using the "one-click installer":http://rubyinstaller.rubyforge.org/. Be sure to install Ruby 1.8.6; support for Ruby 1.9.x is still a work in progress. Once installed, set the @JAVA_HOME@ environment variable and run @gem install buildr --platform mswin32@.
@@ -182,6 +188,17 @@ $ jruby -S buildr
182
188
 
183
189
  Run @buildr --version@ from the command line to find which version of Buildr you are using by default. If you see @(JRuby ...)@, Buildr is running on that version of JRuby.
184
190
 
191
+ h2. Using multiple versions of Buildr
192
+
193
+ Rubygems makes it possible to install several versions of Buildr side-by-side on the same system. If you want to run a specific version, you can do so by adding the version number between underscores ('_') as the first command-line parameter. For example,
194
+
195
+ {% highlight sh %}
196
+ $ buildr _1.3.4_ clean # runs Buildr v1.3.4
197
+
198
+ $ buildr _1.4.4_ clean # runs Buildr v1.4.4
199
+ {% endhighlight %}
200
+
201
+ p(note). There are two `buildr` executables installed by Rubygems. One script serves to select the specified (or default) version of Buildr and is typically found under `/usr/bin/buildr` or `/var/lib/gems/1.8/bin/buildr`. The exact location will vary depending on your system. The other script is the Buildr bootstrap per se and can be found under the specific version of Buildr, e.g, `/var/lib/gems/1.8/gems/buildr-1.4.0/bin/buildr`. The first script should be on your `PATH`. The second script should not be called directly and should not be on your `PATH`.
185
202
 
186
203
  h2(#running). Running Buildr
187
204
 
@@ -19,6 +19,10 @@ title: Mailing Lists
19
19
  | Search | "http://buildr.markmail.org/search/list:commits":http://buildr.markmail.org/search/list:commits |
20
20
  | Subscribe | "commits-subscribe@buildr.apache.org":mailto:commits-subscribe@buildr.apache.org |
21
21
  | Unsubscribe | "commits-unsubscribe@buildr.apache.org":mailto:commits-unsubscribe@buildr.apache.org |
22
+ |_. ci |_. Continuous integration status |
23
+ | Search | "http://buildr.markmail.org/search/list:ci":http://buildr.markmail.org/search/list:ci |
24
+ | Subscribe | "ci-subscribe@buildr.apache.org":mailto:ci-subscribe@buildr.apache.org |
25
+ | Unsubscribe | "ci-unsubscribe@buildr.apache.org":mailto:ci-unsubscribe@buildr.apache.org |
22
26
 
23
27
 
24
28
 
@@ -311,9 +311,13 @@ $ dbuildr clean compile
311
311
 
312
312
  The @dbuildr@ command will start the BuildrServer if there isn't one already running. Subsequent calls to dbuildr will act as the client and invoke the tasks you provide to the server. If the buildfile has been modified it will be reloaded on the BuildrServer.
313
313
 
314
- h2(#growl). Growl, Qube
314
+ h2(#notifications). Notifications: Growl, Libnotify, Qube
315
315
 
316
- For OS X users, Buildr supports "Growl":http://growl.info/ out of the box to send "completed" and "failed" notifications to the user.
316
+ Buildr support sending notifications when the build completes or fails, such as displaying the outcome message in an overlaid window on top of other applications.
317
+
318
+ For OS X users, Buildr supports "Growl":http://growl.info/ out of the box by using the Ruby Cocoa bindings.
319
+
320
+ For Debian-based Linux users, Buildr supports notifications via the "notify-send":http://manpages.ubuntu.com/manpages/gutsy/man1/notify-send.1.html command which is part of the "libnotify-bin":"http://packages.debian.org/search?keywords=libnotify-bin" package. Just make sure `notify-send` is installed and on your path is on your `PATH`.
317
321
 
318
322
  For other platforms or if you want to notify the user differently, Buildr offers two extension points:
319
323
 
@@ -380,15 +384,317 @@ h2(#idea). IntelliJ IDEA
380
384
  If you use IntelliJ IDEA, you can generate project files by issuing:
381
385
 
382
386
  {% highlight sh %}
383
- $ buildr idea
387
+ $ buildr idea:generate
384
388
  {% endhighlight %}
385
389
 
386
- It will generate a @.iml@ file for every project (or subproject) and a @.ipr@ that you can directly open for the root project. To allow IntelliJ Idea to resolve external dependencies properly, you will need to add a @M2_REPO@ variable pointing to your Maven2 repository directory (@Settings / Path Variables@).
390
+ This task will generate a @.iml@ file for every project (or subproject) and a @.ipr@ that you can directly open for the root project.
387
391
 
388
- If you're using IDEA 7 or later, use the @buildr idea7x@ task instead. This task creates the proper @.ipr@ and @.iml@ files for IDEA version 7. It includes the @-7x@ suffix in the generated files, so you can use the @idea@ and @idea7x@ tasks side by side on the same project.
392
+ The generated project files can be removed by issuing:
389
393
 
390
- Also, check out the "Buildr plugin for IDEA":http://www.digitalsanctum.com/buildr-plug-in/ (IDEA 7 and later). Once installed, open your project with IDEA. If IDEA finds that you have Buildr installed and finds a buildfile in the project's directory, it will show all the tasks available for that project. To run a task, double-click it. When the task completes, IDEA will show the results in the Buildr Output window.
394
+ {% highlight sh %}
395
+ $ buildr idea:clean
396
+ {% endhighlight %}
397
+
398
+ The idea task generates the project files based on the settings of each project and idea extension specific settings. The main and test source trees are added to the @.iml@ file for each project as are the respective resource directories. The target and report directories are excluded from the project. If the project files exist on the file system the extension will replace specific component sections in the xml with the generated component configurations.
399
+
400
+ Dependencies come in two forms. Dependencies on other projects and dependencies on external jars. Dependencies on other projects are added as module dependencies in the @.iml@ while jars are added as regular file dependencies. Dependencies are exported from the @.iml@ file if they are compile dependencies. If a artifact that matches dependency but has a classifier of 'sources' is present then it is configured as the source for the dependency. Note: Use "buildr artifacts:sources" to download the source for dependencies.
401
+
402
+ h3. Idea Specific Directives
403
+
404
+ The extension specific settings of sub-projects inherit the parent projects settings unless overwritten.
405
+
406
+ h4. Project file naming
407
+
408
+ The extension will use the last element of the projects name when generating the @.ipr@ and @.iml@ files. i.e. A project named "foo" will generate "foo.iml" and "foo.ipr" while a project named "foo:bar" will generate "bar/bar.iml" and no ipr. (The @.ipr@ project files are only generated for the base project). The name can be modified by setting the "ipr.suffix" or "iml.suffix" settings which specifies the suffix appended to the file names. The user can also override the name completely by setting "ipr.id" or "iml.id".
409
+
410
+ h5. Example: Setting id
411
+
412
+ {% highlight ruby %}
413
+ define "foo" do
414
+ ipr.id = "beep"
415
+ define "bar" do
416
+ iml.id = "baz"
417
+ end
418
+ end
419
+ {% endhighlight %}
420
+
421
+ Will generate:
422
+
423
+ <pre>
424
+ beep.ipr
425
+ foo.iml
426
+ bar/baz.iml
427
+ </pre>
428
+
429
+ h5. Example: Setting suffix
430
+
431
+ {% highlight ruby %}
432
+ define "foo" do
433
+ ipr.suffix = "-suffix1"
434
+ iml.suffix = "-suffix2"
435
+ define "bar"
436
+ end
437
+ {% endhighlight %}
438
+
439
+ Will generate:
440
+
441
+ <pre>
442
+ foo-suffix1.ipr
443
+ foo-suffix2.iml
444
+ bar/bar-suffix2.iml
445
+ </pre>
446
+
447
+ h4. Disabling project file generation
448
+
449
+ The extension will not generate an iml file for a project if the "project.no_iml" method is invoked. Generation of ipr files can be disabled by invoking the method "project.no_ipr".
450
+
451
+ h5. Example
452
+
453
+ {% highlight ruby %}
454
+ define "foo" do
455
+ project.no_ipr
456
+ define "bar" do
457
+ project.no_iml
458
+ end
459
+ end
460
+ {% endhighlight %}
461
+
462
+ Will generate:
463
+
464
+ <pre>
465
+ foo.iml
466
+ </pre>
467
+
468
+ h4. Disabling generation of content section in .iml file
469
+
470
+ The extension will not generate a content section in an iml file if the "iml.skip_content!" method is invoked. This can be useful if a project is just exporting dependencies and has no associated source code. This may also be of use in scenarios where the build is repackaging an existing jar with more meta-data or the project is just a container for other projects.
471
+
472
+ h5. Example
473
+
474
+ {% highlight ruby %}
475
+ define "foo" do
476
+ iml.skip_content!
477
+ end
478
+ {% endhighlight %}
479
+
480
+ h4. VCS Integration
481
+
482
+ The extension will attempt to guess the VCS type of the project by looking for a @.svn@ or @.git@ directory in the base projects directory. If either of these are set it will configure the component as appropriate. Otherwise the user will need to manually specify the project to one of either 'Git' or 'svn' using the ipr.vcs setting.
483
+
484
+ h5. Example
485
+
486
+ {% highlight ruby %}
487
+ define "foo" do
488
+ ipr.vcs = 'Git'
489
+ end
490
+ {% endhighlight %}
491
+
492
+ h4. Adding main, test or exclude paths to the .iml file
493
+
494
+ The extension allows you to add source paths, test source paths or add paths to the excluded set by modifying the "iml.main_source_directories", "iml.test_source_directories" or "iml.excluded_directories" settings respectively. This is only needed when the defaults inherited from project.compile or project.test are not sufficient.
495
+
496
+ h5. Example
497
+
498
+ {% highlight ruby %}
499
+ define "foo" do
500
+ # Add path for generated resources to .iml file
501
+ iml.main_source_directories << _("generated/main/resources")
502
+
503
+ # Add path for generated test resources to .iml file
504
+ iml.test_source_directories << _("generated/test/resources")
505
+
506
+ # Exclude the temp directory created during testing
507
+ iml.excluded_directories << _("tmp")
508
+
509
+ ...
510
+ end
511
+ {% endhighlight %}
512
+
513
+ h4. Adding main or test dependencies to the .iml file
514
+
515
+ The extension allows you to add main or test dependencies by modifying the "iml.main_dependencies" or "iml.test_dependencies" settings respectively. This is only needed when the defaults inherited from project.compile or project.test are not sufficient. Note: These dependencies are not included on compile path when running buildr.
516
+
517
+ h5. Example
518
+
519
+ {% highlight ruby %}
520
+ define "foo" do
521
+ # Add idea specific jar dependency to .iml file
522
+ iml.main_dependencies << 'group:id:jar:1.0'
523
+
524
+ # Add idea specific test jar dependency to .iml file
525
+ iml.test_dependencies << 'group:id:jar:1.0'
526
+ ...
527
+ end
528
+ {% endhighlight %}
529
+
530
+ h4. Dependency generation
531
+
532
+ A file dependency that exists in the local maven 2 repository is stored in the IML file relative to the @$MAVEN_REPOSITORY$@ environment variable (that defaults to @~/.m2/repository@). The user can override the environment variable by setting the "iml.local_repository_env_override" setting. If the dependency does not exist in to maven repository or the "iml.local_repository_env_override" setting is set to nil, then the path stored in the IML is relative to the IML file.
533
+
534
+ h5. Example: Setting local_repository_env_override
535
+
536
+ {% highlight ruby %}
537
+ define "foo" do
538
+ iml.local_repository_env_override = nil
539
+ compile.with 'group:id:jar:1.0'
540
+ end
541
+ {% endhighlight %}
391
542
 
543
+ Will generate a dependency with a path like:
544
+
545
+ <pre>
546
+ jar:///home/peter/.m2/repository/group/id/1.0/id-1.0.jar!/
547
+ </pre>
548
+
549
+ rather than the default
550
+
551
+ <pre>
552
+ jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/
553
+ </pre>
554
+
555
+ h5. Example: A dependency outside the maven repository
556
+
557
+ {% highlight ruby %}
558
+ define "foo" do
559
+ compile.with _("foos-dep.jar")
560
+ end
561
+ {% endhighlight %}
562
+
563
+ Will generate a dependency with a path like:
564
+
565
+ <pre>
566
+ jar://$MODULE_DIR$/foo-dep.jar!/
567
+ </pre>
568
+
569
+ h4. Module Facets
570
+
571
+ Facets are IDEAs mechanism for adding support for languages, tools and frameworks other than core java. A facet can be added to a project so that it can be deployed as a web application or a hibernate application. A facet can also be used t provide support for other languages such as ruby and scala. The extension makes it possible to generate @.iml@ with the appropriate facets via the "iml.add_facet" method. It should be noted that facets are NOT inherited by sub-projects.
572
+
573
+ h5. Example
574
+
575
+ This example adds the web facet to a project.
576
+
577
+ {% highlight ruby %}
578
+ define "foo" do
579
+ iml.add_facet("Web","web") do |facet|
580
+ facet.configuration do |conf|
581
+ conf.descriptors do |desc|
582
+ desc.deploymentDescriptor :name => 'web.xml',
583
+ :url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
584
+ :optional => "false", :version => "2.4"
585
+ end
586
+ conf.webroots do |webroots|
587
+ webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
588
+ end
589
+ end
590
+ end
591
+ end
592
+ {% endhighlight %}
593
+
594
+ h4. Custom Component Sections
595
+
596
+ If the extension does not provide capability to generate configuration for a particular IDEA plugin the user can provide their own configuration data via the "ipr.add_component" or "iml.add_component" methods.
597
+
598
+ h5. Example: Adding .ipr specific component
599
+
600
+ This example changes the compiler configuration for project.
601
+
602
+ {% highlight ruby %}
603
+ define "foo" do
604
+ ipr.add_component("CompilerConfiguration") do |component|
605
+ component.option :name => 'DEFAULT_COMPILER', :value => 'Javac'
606
+ component.option :name => 'DEPLOY_AFTER_MAKE', :value => '0'
607
+ component.resourceExtensions do |xml|
608
+ xml.entry :name => '.+\.nonexistent'
609
+ end
610
+ component.wildcardResourceExtensions do |xml|
611
+ xml.entry :name => '?*.nonexistent'
612
+ end
613
+ end
614
+ end
615
+ {% endhighlight %}
616
+
617
+ h5. Example: Adding .iml specific component
618
+
619
+ This example adds the web facet to a project. Note: This overrides the facets defined by the "iml.add_facet" method.
620
+
621
+ {% highlight ruby %}
622
+ define "foo" do
623
+ iml.add_component("FacetManager") do |component|
624
+ component.facet :type => 'web', :name => 'Web' do |facet|
625
+ facet.configuration do |conf|
626
+ conf.descriptors do |desc|
627
+ desc.deploymentDescriptor :name => 'web.xml',
628
+ :url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
629
+ :optional => "false", :version => "2.4"
630
+ end
631
+ conf.webroots do |webroots|
632
+ webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
638
+ {% endhighlight %}
639
+
640
+ h4. Templates
641
+
642
+ The underlying project files are xml the contain elements for a number of "components". The extension will load any existing project files and replace or add any component elements that are generated by the extension. The extension also allows the user to specify a template with either "ipr.template" or "iml.template" settings. If a template is specified it will be loaded and any component elements in these documents will be merged into the base document prior to merging in generated sections. Templates are useful if you want to enforce certain configuration options (i.e. project specific code style).
643
+
644
+ h5. Example
645
+
646
+ {% highlight ruby %}
647
+ define "foo" do
648
+ ipr.template = 'project.ipr.template'
649
+ iml.template = 'module.iml.template'
650
+ end
651
+ {% endhighlight %}
652
+
653
+ h4. Groups
654
+
655
+ IDEA provides the facility to organise modules into groups. By default the extension does not do this but it can be enabled by "iml.group" setting. If that setting is set to true then the @.iml@ file will be placed in a group based on the parent projects name. If the setting is a string then that is used as the name of the group.
656
+
657
+ h5. Example
658
+
659
+ {% highlight ruby %}
660
+ define "foo" do
661
+ iml.group = true
662
+ define 'bar' do
663
+ define 'baz'
664
+ end
665
+ define 'rab' do
666
+ iml.group = "MyGroup"
667
+ end
668
+ end
669
+ {% endhighlight %}
670
+
671
+ Will place the generated .imls in the following groups:
672
+
673
+ <pre>
674
+ foo.iml => ''
675
+ bar/bar.iml => 'foo'
676
+ bar/baz/baz.iml => 'foo/bar'
677
+ rab/rab.iml => 'MyGroup'
678
+ </pre>
679
+
680
+ h4. Add Extra .iml files to .ipr
681
+
682
+ The 'ipr.extra_modules' setting makes it possible to add extra modules to the generated iml file. The setting is an array of file names relative to the base project directory.
683
+
684
+ h5. Example
685
+
686
+ {% highlight ruby %}
687
+ define "foo" do
688
+ ipr.extra_modules << 'other.iml'
689
+ ipr.extra_modules << 'other_other.iml'
690
+ end
691
+ {% endhighlight %}
692
+
693
+ Will add the 'other.iml' and 'other_other.iml' files to the @.ipr@ project files.
694
+
695
+ h4. Buildr plugin for IDEA
696
+
697
+ Also, check out the "Buildr plugin for IDEA":http://www.digitalsanctum.com/buildr-plug-in/ (IDEA 7 and later). Once installed, open your project with IDEA. If IDEA finds that you have Buildr installed and finds a buildfile in the project's directory, it will show all the tasks available for that project. To run a task, double-click it. When the task completes, IDEA will show the results in the Buildr Output window.
392
698
 
393
699
  h2(#cobertura_emma_jdepend). Cobertura, Emma, JDepend
394
700
 
@@ -460,6 +766,27 @@ $ buildr --require buildr/jdepend jdepend:swing
460
766
  $ buildr -rbuildr/java/cobertura cobertura:html
461
767
  {% endhighlight %}
462
768
 
769
+ h2(#jaxb_xjc). JAXB Xjc Compiler
770
+
771
+ Buildr includes an extension that provides the ability to invoke jaxb xjc binding compiler. A typical project that uses the extension may look something like;
772
+
773
+ {% highlight ruby %}
774
+ require 'buildr/jaxb_xjc'
775
+
776
+ define "foo" do
777
+ project.version = "1.0.0"
778
+ compile.from compile_jaxb(_('src/schemas/wildfire-1.3.xsd'),
779
+ "-quiet",
780
+ :package => "org.foo.api")
781
+ package :jar
782
+ end
783
+ {% endhighlight %}
784
+
785
+ The method compile_jaxb accepts either an array of files or a single file as the first parameter. It then accepts 0 or more arguments that are passed to the underlying XJC compiler. The arguments are documented on the "jaxb site":https://jaxb.dev.java.net/nonav/2.2.1/docs/xjc.html. If the last argument is an options hash then the extension handles the options hash specially. The supported options include:
786
+
787
+ * <tt>:directory</tt>: The directory to which source is generated. Defaults to <tt>_(:target, :generated, :jaxb)</tt>
788
+ * <tt>:keep_content</tt>: By default the generated directory will be deleted. If <tt>true</tt> is specified for this parameter the directory will not be deleted.
789
+ * <tt>:package</tt>: The package in which the source is generated.
463
790
 
464
791
  h2(#anything_ruby). Anything Ruby Can Do
465
792
 
@@ -314,17 +314,203 @@ EAR packages include an @application.xml@ file in the @META-INF@ directory that
314
314
 
315
315
  * *display-name* -- The application's display name defaults to the project's identifier. You can change that by setting the @display_name@ attribute.
316
316
 
317
+ * *description* -- The application's description defaults to the project's comment. You can change that by setting the @description@ attribute.
318
+
317
319
  * *context-root* -- WAR components specify a context root, based on the package identifier, for example, "cool-web-1.0.war" will have the context root "cool-web". To specify a different context root, add the WAR package with the @context_root@ option.
318
320
 
319
321
  Again, by example:
320
322
 
321
323
  {% highlight ruby %}
322
324
  package(:ear).display_name = 'MyCoolWebService'
323
- package(:ear).add project('coolWebService').package(:war), :context-root=>'coolness'
325
+ package(:ear).description = 'MyCoolWebService: Making coolness kool again'
326
+ package(:ear).add project('coolWebService').package(:war), :context_root=>'coolness'
324
327
  {% endhighlight %}
325
328
 
326
329
  If you need to disable the context root (e.g. for Portlets), set @context_root@ to @false@.
327
330
 
331
+ It is also possible to add @security-role@ tags to the @application.xml@ file by appending a hash with @:id@, @:description@ and @:name@ to the @security_role@ array, like so:
332
+
333
+ {% highlight ruby %}
334
+ package(:ear).security_roles << {:id=>'SecurityRole_123',
335
+ :description=>'Read only user', :name=>'coolUser'}
336
+ package(:ear).security_roles << {:id=>'SecurityRole_456',
337
+ :description=>'Super user', :name=>'superCoolUser'}
338
+ {% endhighlight %}
339
+
340
+ h2(#bundle). Packaging OSGi Bundles
341
+
342
+ OSGi bundles are jar files with additional metadata stored in the manifest. Buildr uses an external tool "Bnd":http://www.aqute.biz/Code/Bnd to create the package. Directives and properties can be explicitly passed to the build tool and buildr will provide reasonable defaults for properties that can be derived from the project model. Please see the bnd tool for documentation on the available properties.
343
+
344
+ The bundle packaging format is included as an addon so the build file must explicitly require the addon using using <code>require "buildr/bnd"</code> and must add a remote repository from which the bnd can be downloaded. A typical project that uses the bundle packaging addon may look something like;
345
+
346
+ {% highlight ruby %}
347
+ require "buildr/bnd"
348
+
349
+ repositories.remote << Buildr::Bnd.remote_repository
350
+
351
+ define 'myProject' do
352
+ ...
353
+ package(:bundle).tap do |bnd|
354
+ bnd['Import-Package'] = "*;resolution:=optional"
355
+ bnd['Export-Package'] = "*;version=#{version}"
356
+ end
357
+ ...
358
+ end
359
+ {% endhighlight %}
360
+
361
+ The @[]@ method on the bundle package is used to provide directives to the bnd tool that are not inherited by sub-projects while the standard 'manifest' setting is used to define properties that inherited by sub-projects.
362
+
363
+ h3. Defaults
364
+
365
+ The addon sets the following bnd parameters;
366
+
367
+ * <tt>"Bundle-Version"</tt> defaults to the project version.
368
+ * <tt>"Bundle-SymbolicName"</tt> defaults to the concatenation of the project group and project id, replacing ':' characters with '.'.
369
+ * <tt>"Bundle-Name"</tt> defaults to the project description if present else the project name
370
+ * <tt>"Bundle-Description"</tt> defaults to the project description.
371
+ * <tt>"-classpath"</tt> is set to the compile target directory and any compile time dependencies.
372
+ * <tt>"Include-Resource"</tt> defaults to the dir project.resources.target if it exists.
373
+
374
+ h3. Parameters
375
+
376
+ h4. classpath_element
377
+
378
+ The user can also specify additional elements that are added to the classpath using the 'classpath_element' method. If the parameter to this element is a task, artifact, artifact namespace etc. then it will be resolved prior to invoking bnd.
379
+
380
+ {% highlight ruby %}
381
+ ...
382
+ define 'foo' do
383
+ ...
384
+ package(:bundle).tap do |bnd|
385
+ # This dependency will be added to classpath
386
+ bnd.classpath_element 'someOtherExistingFile.zip'
387
+ # All of these dependencies will be invoked and added to classpath
388
+ bnd.classpath_element artifact('com.sun.messaging.mq:imq:jar:4.4')
389
+ bnd.classpath_element project('bar') # Adds all the packages
390
+ bnd.classpath_element 'org.apache.ant:ant:jar:1.8.0'
391
+ bnd.classpath_element file('myLocalFile.jar')
392
+ ...
393
+ end
394
+
395
+ project 'bar' do
396
+ ...
397
+ end
398
+ end
399
+ {% endhighlight %}
400
+
401
+ h4. classpath
402
+
403
+ The user can specify the complete classpath using the 'classpath' method. The classpath should be an array of elements. If the element is a task, artifact, artifact namespace etc. then it will be resolved prior to invoking bnd.
404
+
405
+ {% highlight ruby %}
406
+ ...
407
+ define 'foo' do
408
+ ...
409
+ package(:bundle).tap do |bnd|
410
+ bnd.classpath [ project.compile.target,
411
+ 'someOtherExistingFile.zip',
412
+ artifact('com.sun.messaging.mq:imq:jar:4.4'),
413
+ project('bar'),
414
+ 'org.apache.ant:ant:jar:1.8.0',
415
+ file('myLocalFile.jar') ]
416
+ ...
417
+ end
418
+
419
+ project 'bar' do
420
+ ...
421
+ end
422
+ end
423
+ {% endhighlight %}
424
+
425
+ h3. Examples
426
+
427
+ h4. Including non-class resources in a bundle
428
+
429
+ Bnd can be used to include non-class resources in a bundle. The following example includes all resources in 'src/etc' into the bundle.
430
+
431
+ {% highlight ruby %}
432
+ define 'myproject' do
433
+ ...
434
+ package(:bundle).tap do |bnd|
435
+ bnd['Include-Resource'] = project._('src/etc') + '/'
436
+ ...
437
+ end
438
+ end
439
+ {% endhighlight %}
440
+
441
+ h4. Using bnd to wrap an existing jar
442
+
443
+ Bnd can be used to wrap an existing jar as an OSGi bundle. The following example wraps the OpenMQ JMS provider as an OSGi bundle.
444
+
445
+ {% highlight ruby %}
446
+ ...
447
+ # Add repository for OpenMQ
448
+ repositories.remote << 'http://download.java.net/maven/2'
449
+
450
+ desc 'OSGi bundle for OpenMQ JMS provider client library'
451
+ define 'com.sun.messaging.mq.imq' do
452
+ project.version = '4.4'
453
+ project.group = 'iris'
454
+ package(:bundle).tap do |bnd|
455
+ bnd['Import-Package'] = "*;resolution:=optional"
456
+ bnd['Export-Package'] = "com.sun.messaging.*;version=#{version}"
457
+ bnd.classpath_element 'com.sun.messaging.mq:imq:jar:4.4'
458
+ end
459
+ end
460
+ {% endhighlight %}
461
+
462
+ h4. Create an OSGi bundle with an Activator
463
+
464
+ The following example presents a basic buildfile for building an OSGi bundle with an activator.
465
+
466
+ {% highlight ruby %}
467
+ ...
468
+ # repository for OSGi core bundle
469
+ repositories.remote << 'https://repository.apache.org/content/repositories/releases'
470
+
471
+ desc 'Hello World bundle'
472
+ define 'helloworld' do
473
+ project.version = '1.0'
474
+ project.group = 'org.example'
475
+ compile.with 'org.apache.felix:org.osgi.core:jar:1.4.0'
476
+ package(:bundle).tap do |bnd|
477
+ bnd['Export-Package'] = "org.example.helloworld.api.*;version=#{version}"
478
+ bnd['Bundle-Activator'] = "org.example.helloworld.Activator"
479
+ end
480
+ end
481
+ {% endhighlight %}
482
+
483
+ h4. Inheriting parameters for bnd tool
484
+
485
+ The following example shows how you can use 'manifest' to define a bnd parameter that is inherited by all child sub-projects. The "Bundle-License" defined in the top level project is passed to the bnd tool when generating both the 'fe' and 'fi' sub-projects but the 'fo' sub-project overrides this parameter with a local value.
486
+
487
+ {% highlight ruby %}
488
+ ...
489
+ define 'myproject' do
490
+ manifest['Bundle-License'] = "http://www.apache.org/licenses/LICENSE-2.0"
491
+ ...
492
+ define 'fe' do
493
+ ...
494
+ package(:bundle).tap do |bnd|
495
+ ...
496
+ end
497
+ end
498
+
499
+ define 'fi' do
500
+ ...
501
+ package(:bundle).tap do |bnd|
502
+ ...
503
+ end
504
+ end
505
+
506
+ define 'fo' do
507
+ ...
508
+ package(:bundle).tap do |bnd|
509
+ bnd['Bundle-License'] = "http://www.apache.org/licenses/LICENSE-1.1"
510
+ end
511
+ end
512
+ end
513
+ {% endhighlight %}
328
514
 
329
515
  h2(#tar). Packaging Tars and GZipped Tars
330
516