buildr 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/CHANGELOG +76 -0
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -37
  5. data/_buildr +3 -12
  6. data/{doc/print.toc.yaml → _jbuildr} +14 -14
  7. data/addon/buildr/cobertura.rb +5 -219
  8. data/addon/buildr/drb.rb +281 -0
  9. data/addon/buildr/emma.rb +5 -221
  10. data/addon/buildr/nailgun.rb +93 -689
  11. data/bin/buildr +0 -9
  12. data/buildr.buildfile +4 -4
  13. data/buildr.gemspec +27 -21
  14. data/doc/_layouts/default.html +82 -0
  15. data/doc/_layouts/preface.html +22 -0
  16. data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
  17. data/doc/{pages/building.textile → building.textile} +89 -47
  18. data/doc/{pages/contributing.textile → contributing.textile} +53 -45
  19. data/doc/css/default.css +6 -5
  20. data/doc/css/print.css +17 -24
  21. data/doc/css/syntax.css +7 -36
  22. data/doc/download.textile +78 -0
  23. data/doc/{pages/extending.textile → extending.textile} +45 -24
  24. data/doc/{pages/getting_started.textile → getting_started.textile} +146 -88
  25. data/doc/images/asf-logo.gif +0 -0
  26. data/doc/images/note.png +0 -0
  27. data/doc/index.textile +47 -0
  28. data/doc/{pages/languages.textile → languages.textile} +108 -54
  29. data/doc/mailing_lists.textile +25 -0
  30. data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
  31. data/doc/{pages/packaging.textile → packaging.textile} +181 -96
  32. data/doc/preface.textile +28 -0
  33. data/doc/{pages/projects.textile → projects.textile} +55 -40
  34. data/doc/scripts/buildr-git.rb +364 -264
  35. data/doc/scripts/gitflow.rb +296 -0
  36. data/doc/scripts/install-jruby.sh +2 -2
  37. data/doc/scripts/install-linux.sh +6 -6
  38. data/doc/scripts/install-osx.sh +2 -2
  39. data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
  40. data/doc/{pages/testing.textile → testing.textile} +77 -41
  41. data/lib/buildr.rb +5 -5
  42. data/lib/buildr/core.rb +2 -0
  43. data/lib/buildr/core/application.rb +321 -151
  44. data/lib/buildr/core/build.rb +298 -167
  45. data/lib/buildr/core/checks.rb +4 -132
  46. data/lib/buildr/core/common.rb +1 -5
  47. data/lib/buildr/core/compile.rb +3 -9
  48. data/lib/buildr/core/environment.rb +12 -3
  49. data/lib/buildr/core/filter.rb +20 -18
  50. data/lib/buildr/core/generate.rb +36 -36
  51. data/lib/buildr/core/help.rb +2 -1
  52. data/lib/buildr/core/osx.rb +46 -0
  53. data/lib/buildr/core/progressbar.rb +1 -1
  54. data/lib/buildr/core/project.rb +7 -34
  55. data/lib/buildr/core/test.rb +12 -6
  56. data/lib/buildr/core/transports.rb +13 -11
  57. data/lib/buildr/core/util.rb +14 -23
  58. data/lib/buildr/groovy/bdd.rb +3 -2
  59. data/lib/buildr/groovy/compiler.rb +1 -1
  60. data/lib/buildr/ide/eclipse.rb +31 -21
  61. data/lib/buildr/ide/idea.rb +3 -2
  62. data/lib/buildr/ide/idea7x.rb +6 -4
  63. data/lib/buildr/java/ant.rb +3 -1
  64. data/lib/buildr/java/bdd.rb +9 -7
  65. data/lib/buildr/java/cobertura.rb +243 -0
  66. data/lib/buildr/java/compiler.rb +5 -4
  67. data/lib/buildr/java/emma.rb +244 -0
  68. data/lib/buildr/java/packaging.rb +11 -8
  69. data/lib/buildr/java/pom.rb +0 -4
  70. data/lib/buildr/java/rjb.rb +1 -1
  71. data/lib/buildr/java/test_result.rb +5 -7
  72. data/lib/buildr/java/tests.rb +17 -11
  73. data/lib/buildr/packaging.rb +5 -2
  74. data/lib/buildr/packaging/archive.rb +488 -0
  75. data/lib/buildr/packaging/artifact.rb +48 -29
  76. data/lib/buildr/packaging/artifact_namespace.rb +6 -6
  77. data/lib/buildr/packaging/gems.rb +4 -4
  78. data/lib/buildr/packaging/package.rb +3 -2
  79. data/lib/buildr/packaging/tar.rb +85 -3
  80. data/lib/buildr/packaging/version_requirement.rb +172 -0
  81. data/lib/buildr/packaging/zip.rb +24 -682
  82. data/lib/buildr/packaging/ziptask.rb +313 -0
  83. data/lib/buildr/scala.rb +5 -0
  84. data/lib/buildr/scala/bdd.rb +100 -0
  85. data/lib/buildr/scala/compiler.rb +45 -4
  86. data/lib/buildr/scala/tests.rb +12 -59
  87. data/rakelib/checks.rake +57 -0
  88. data/rakelib/doc.rake +58 -68
  89. data/rakelib/jekylltask.rb +110 -0
  90. data/rakelib/package.rake +35 -37
  91. data/rakelib/release.rake +119 -35
  92. data/rakelib/rspec.rake +29 -39
  93. data/rakelib/setup.rake +21 -59
  94. data/rakelib/stage.rake +184 -26
  95. data/spec/addon/drb_spec.rb +328 -0
  96. data/spec/core/application_spec.rb +32 -25
  97. data/spec/core/build_spec.rb +336 -126
  98. data/spec/core/checks_spec.rb +292 -310
  99. data/spec/core/common_spec.rb +8 -2
  100. data/spec/core/compile_spec.rb +17 -1
  101. data/spec/core/generate_spec.rb +3 -3
  102. data/spec/core/project_spec.rb +18 -10
  103. data/spec/core/test_spec.rb +8 -1
  104. data/spec/core/transport_spec.rb +40 -3
  105. data/spec/core/util_spec.rb +67 -0
  106. data/spec/ide/eclipse_spec.rb +96 -28
  107. data/spec/ide/idea7x_spec.rb +84 -0
  108. data/spec/java/ant.rb +5 -0
  109. data/spec/java/bdd_spec.rb +12 -3
  110. data/spec/{addon → java}/cobertura_spec.rb +6 -6
  111. data/spec/{addon → java}/emma_spec.rb +5 -6
  112. data/spec/java/java_spec.rb +12 -2
  113. data/spec/java/packaging_spec.rb +31 -2
  114. data/spec/{addon → java}/test_coverage_spec.rb +3 -3
  115. data/spec/java/tests_spec.rb +5 -0
  116. data/spec/packaging/archive_spec.rb +11 -1
  117. data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
  118. data/spec/packaging/artifact_spec.rb +44 -3
  119. data/spec/packaging/packaging_spec.rb +1 -1
  120. data/spec/sandbox.rb +17 -14
  121. data/spec/scala/bdd_spec.rb +150 -0
  122. data/spec/scala/compiler_spec.rb +27 -0
  123. data/spec/scala/scala.rb +38 -0
  124. data/spec/scala/tests_spec.rb +78 -33
  125. data/spec/spec_helpers.rb +29 -5
  126. data/spec/version_requirement_spec.rb +6 -0
  127. metadata +175 -171
  128. data/DISCLAIMER +0 -7
  129. data/doc/images/apache-incubator-logo.png +0 -0
  130. data/doc/pages/download.textile +0 -51
  131. data/doc/pages/index.textile +0 -42
  132. data/doc/pages/mailing_lists.textile +0 -17
  133. data/doc/pages/recipes.textile +0 -103
  134. data/doc/pages/troubleshooting.textile +0 -103
  135. data/doc/pages/whats_new.textile +0 -323
  136. data/doc/print.haml +0 -51
  137. data/doc/site.haml +0 -56
  138. data/doc/site.toc.yaml +0 -47
  139. data/etc/git-svn-authors +0 -16
  140. data/lib/buildr/core/application_cli.rb +0 -139
  141. data/rakelib/apache.rake +0 -191
  142. data/rakelib/changelog.rake +0 -57
  143. data/rakelib/rubyforge.rake +0 -53
  144. data/rakelib/scm.rake +0 -49
@@ -1,38 +1,49 @@
1
- h1. Packaging
1
+ ---
2
+ layout: default
3
+ title: Packaging
4
+ ---
2
5
 
3
6
  For our next trick, we're going to try and create an artifact ourselves. We're going to start with:
4
7
 
5
- {{{!ruby
8
+ <notextile>
9
+ {% highlight ruby %}
6
10
  package :jar
7
- }}}
11
+ {% endhighlight %}
12
+ </notextile>
8
13
 
9
14
  We just told the project to create a JAR file in the @target@ directory, including all the classes (and resources) that we previously compiled into @target/classes@. Or we can create a WAR file:
10
15
 
11
- {{{!ruby
16
+ <notextile>
17
+ {% highlight ruby %}
12
18
  package :war
13
- }}}
19
+ {% endhighlight %}
20
+ </notextile>
14
21
 
15
22
  The easy case is always easy, but sometimes we have more complicated use cases which we'll address through the rest of this section.
16
23
 
17
24
  Now let's run the build, test cases and create these packages:
18
25
 
19
- {{{!sh
26
+ <notextile>
27
+ {% highlight sh %}
20
28
  $ buildr package
21
- }}}
29
+ {% endhighlight %}
30
+ </notextile>
22
31
 
23
32
  The @package@ task runs the @build@ task (remember: @compile@ and @test@) and then runs each of the packaging tasks, creating packages in the projects' target directories.
24
33
 
25
34
  p(tip). The @package@ task and @package@ methods are related, but that relation is different from other task/method pairs. The @package@ method creates a file task that points to the package in the @target@ directory and knows how to create it. It then adds itself as a prerequisite to the @package@ task. Translation: you can create multiple packages from the same project.
26
35
 
27
36
 
28
- h2. Specifying And Referencing Packages
37
+ h2(#referencing). Specifying And Referencing Packages
29
38
 
30
39
  Buildr supports several packaging types, and so when dealing with packages, you have to indicate the desired package type. The packaging type can be the first argument, or the value of the @:type@ argument. The following two are equivalent:
31
40
 
32
- {{{!ruby
41
+ <notextile>
42
+ {% highlight ruby %}
33
43
  package :jar
34
44
  package :type=>:jar
35
- }}}
45
+ {% endhighlight %}
46
+ </notextile>
36
47
 
37
48
  If you do not specify a package type, Buildr will attempt to infer one.
38
49
 
@@ -40,19 +51,22 @@ In the documentation you will find a number of tasks dealing with specific packa
40
51
 
41
52
  To package a particular file, use the @:file@ argument, for example:
42
53
 
43
- {{{!ruby
54
+ <notextile>
55
+ {% highlight ruby %}
44
56
  package :zip, :file=>_('target/interesting.zip')
45
- }}}
57
+ {% endhighlight %}
58
+ </notextile>
46
59
 
47
60
  This returns a file task that will run as part of the project's @package@ task (generating all packages). It will invoke the @build@ task to generate any necessary prerequisites, before creating the specified file.
48
61
 
49
62
  The package type does not have to be the same as the file name extension, but if you don't specify the package type, it will be inferred from the extension.
50
63
 
51
- Most often you will want to use the second form to generate packages that are also artifacts. These packages have an artifact specification, which you can use to reference them from other projects (and buildfiles). They are also easier to share across projects: artifacts install themselves in the local repository when running the @install@ task, and upload to the remote repository when running the @upload@ task (see "Installing and Uploading":#installing_and_uploading).
64
+ Most often you will want to use the second form to generate packages that are also artifacts. These packages have an artifact specification, which you can use to reference them from other projects (and buildfiles). They are also easier to share across projects: artifacts install themselves in the local repository when running the @install@ task, and upload to the remote repository when running the @upload@ task (see "Installing and Uploading":#install_upload).
52
65
 
53
66
  The artifact specification is based on the project name (using dashes instead of colons), group identifier and version number, all three obtained from the project definition. You can specify different values using the @:id@, @:group@, @:version@ and @:classifier@ arguments. For example:
54
67
 
55
- {{{!ruby
68
+ <notextile>
69
+ {% highlight ruby %}
56
70
  define 'killer-app', :version=>'1.0' do
57
71
  # Generates silly-1.0.jar
58
72
  package :jar, :id=>'silly'
@@ -67,7 +81,8 @@ define 'killer-app', :version=>'1.0' do
67
81
  package :zip, :classifier=>'sources'
68
82
  end
69
83
  end
70
- }}}
84
+ {% endhighlight %}
85
+ </notextile>
71
86
 
72
87
  The file name is determined from the identifier, version number, classifier and extension associated with that packaging type.
73
88
 
@@ -77,45 +92,55 @@ A single project can create multiple packages. For example, a Java project may
77
92
 
78
93
  You can use the @packages@ method to obtain a list of all packages defined in the project, for example:
79
94
 
80
- {{{!ruby
95
+ <notextile>
96
+ {% highlight ruby %}
81
97
  project('killer-app:teh-impl').packages.first
82
98
  project('killer-app:teh-impl').packages.select { |pkg| pkg.type == :zip }
83
- }}}
99
+ {% endhighlight %}
100
+ </notextile>
84
101
 
85
102
 
86
- h2. Packaging ZIPs
103
+ h2(#zip). Packaging ZIPs
87
104
 
88
105
  ZIP is the most common form of packaging, used by default when no other packaging type applies. It also forms the basis for many other packaging types (e.g. JAR and WAR). Most of what you'll find here applies to other packaging types.
89
106
 
90
107
  Let's start by including additional files in the ZIP package. We're going to include the @target/docs@ directory and @README@ file:
91
108
 
92
- {{{!ruby
109
+ <notextile>
110
+ {% highlight ruby %}
93
111
  package(:zip).include _('target/docs'), 'README'
94
- }}}
112
+ {% endhighlight %}
113
+ </notextile>
95
114
 
96
115
  The @include@ method accepts files, directories and file tasks. You can also use file pattern to match multiple files and directories. File patterns include asterisk (@*@) to match any file name or part of a file name, double asterisk (@**@) to match directories recursively, question mark (@?@) to match any character, square braces (@[]@) to match a set of characters, and curly braces (@{}@) to match one of several names.
97
116
 
98
117
  And the same way you @include@, you can also @exclude@ specific files you don't want showing up in the ZIP. For example, to exclude @.draft@ and @.raw@ files:
99
118
 
100
- {{{!ruby
119
+ <notextile>
120
+ {% highlight ruby %}
101
121
  package(:zip).include('target/docs').
102
122
  exclude('target/docs/**/*.{draft,raw}')
103
- }}}
123
+ {% endhighlight %}
124
+ </notextile>
104
125
 
105
126
  So far we've included files under the root of the ZIP. Let's include some files under a given path using the @:path@ option:
106
127
 
107
- {{{!ruby
128
+ <notextile>
129
+ {% highlight ruby %}
108
130
  package(:zip).include 'target/docs', :path=>"#{id}-#{version}"
109
- }}}
131
+ {% endhighlight %}
132
+ </notextile>
110
133
 
111
134
  If you need to use the @:path@ option repeatedly, consider using the @tap@ method instead. For example:
112
135
 
113
- {{{!ruby
136
+ <notextile>
137
+ {% highlight ruby %}
114
138
  package(:zip).path("#{id}-#{version}").tap do |path|
115
139
  path.include 'target/docs'
116
140
  path.include 'README'
117
141
  end
118
- }}}
142
+ {% endhighlight %}
143
+ </notextile>
119
144
 
120
145
  p(tip). The @tap@ method is not part of the core library, but a very useful extension. It takes an object, yields to the block with that object, and then returns that object.
121
146
 
@@ -123,16 +148,20 @@ p(note). To allow you to spread files across different paths, the include/exclud
123
148
 
124
149
  If you need to include a file or directory under a different name, use the @:as@ option. For example:
125
150
 
126
- {{{!ruby
151
+ <notextile>
152
+ {% highlight ruby %}
127
153
  package(:zip).include('corporate-logo-350x240.png', :as=>'logo.png')
128
- }}}
154
+ {% endhighlight %}
155
+ </notextile>
129
156
 
130
157
  You can also use @:as=>'.'@ to include all files from the given directory. For example:
131
158
 
132
- {{{!ruby
159
+ <notextile>
160
+ {% highlight ruby %}
133
161
  package(:zip).include 'target/docs/*'
134
162
  package(:zip).include 'target/docs', :as=>'.'
135
- }}}
163
+ {% endhighlight %}
164
+ </notextile>
136
165
 
137
166
  These two are almost identical. They both include all the files from the @target/docs@ directory, but not the directory itself. But they operate differently. The first line expands to include all the files in @target/docs@. If you don't already have files in @target/docs@, well, then it won't do anything interesting. Your ZIP will come up empty. The second file includes the directory itself, but strips the path during inclusion. You can define it now, create these files later, and then ZIP them all up.
138
167
 
@@ -142,33 +171,41 @@ If you need to get rid of all the included files, call the @clean@ method. Some
142
171
 
143
172
  You can also merge two ZIP files together, expanding the content of one ZIP into the other. For example:
144
173
 
145
- {{{!ruby
174
+ <notextile>
175
+ {% highlight ruby %}
146
176
  package(:zip).merge 'part1.zip', 'part2.zip'
147
- }}}
177
+ {% endhighlight %}
178
+ </notextile>
148
179
 
149
180
  If you need to be more selective, you can apply the include/exclude pattern to the expanded ZIP. For example:
150
181
 
151
- {{{!ruby
182
+ <notextile>
183
+ {% highlight ruby %}
152
184
  # Everything but the libs
153
185
  package(:zip).merge('bigbad.war').exclude('libs/**/*')
154
- }}}
186
+ {% endhighlight %}
187
+ </notextile>
155
188
 
156
189
 
157
- h2. Packaging JARs
190
+ h2(#jar). Packaging JARs
158
191
 
159
192
  JAR packages extend ZIP packages with support for Manifest files and the META-INF directory. They also default to include the class files found in the @target/classes@ directory.
160
193
 
161
194
  You can tell the JAR package to include a particular Manifest file:
162
195
 
163
- {{{!ruby
196
+ <notextile>
197
+ {% highlight ruby %}
164
198
  package(:jar).with :manifest=>_('src/main/MANIFEST.MF')
165
- }}}
199
+ {% endhighlight %}
200
+ </notextile>
166
201
 
167
202
  Or generate a manifest from a hash:
168
203
 
169
- {{{!ruby
204
+ <notextile>
205
+ {% highlight ruby %}
170
206
  package(:jar).with :manifest=>{ 'Copyright'=>'Acme Inc (C) 2007' }
171
- }}}
207
+ {% endhighlight %}
208
+ </notextile>
172
209
 
173
210
  You can also generate a JAR with no manifest with the value @false@, create a manifest with several sections using an array of hashes, or create it from a proc.
174
211
 
@@ -176,32 +213,40 @@ In large projects, where all the packages use the same manifest, it's easier to
176
213
 
177
214
  For example, we can get the same result by specifying this at the top project:
178
215
 
179
- {{{!ruby
216
+ <notextile>
217
+ {% highlight ruby %}
180
218
  manifest['Copyright'] = 'Acme Inc (C) 2007'
181
- }}}
219
+ {% endhighlight %}
220
+ </notextile>
182
221
 
183
222
  If you need to mix-in the project's manifest with values that only one package uses, you can do so easily:
184
223
 
185
- {{{!ruby
224
+ <notextile>
225
+ {% highlight ruby %}
186
226
  package(:jar).with :manifest=>manifest.merge('Main-Class'=>'com.acme.Main')
187
- }}}
227
+ {% endhighlight %}
228
+ </notextile>
188
229
 
189
230
  If you need to include more files in the @META-INF@ directory, you can use the @:meta_inf@ option. You can give it a file, or array of files. And yes, there is a @meta_inf@ project property you can set once to include the same set of file in all the JARs. It works like this:
190
231
 
191
- {{{!ruby
232
+ <notextile>
233
+ {% highlight ruby %}
192
234
  meta_inf << file('DISCLAIMER') << file('NOTICE')
193
- }}}
235
+ {% endhighlight %}
236
+ </notextile>
194
237
 
195
238
  If you have a @LICENSE@ file, it's already included in the @meta_inf@ list of files.
196
239
 
197
240
  Other than that, @package :jar@ includes the contents of the compiler's target directory and resources, which most often is exactly what you intend it to do. If you want to include other files in the JAR, instead or in addition, you can do so using the @include@ and @exclude@ methods. If you do not want the target directory included in your JAR, simply call the @clean@ method on it:
198
241
 
199
- {{{!ruby
242
+ <notextile>
243
+ {% highlight ruby %}
200
244
  package(:jar).clean.include( only_these_files )
201
- }}}
245
+ {% endhighlight %}
246
+ </notextile>
202
247
 
203
248
 
204
- h2. Packaging WARs
249
+ h2(#war). Packaging WARs
205
250
 
206
251
  Pretty much everything you know about JARs works the same way for WARs, so let's just look at the differences.
207
252
 
@@ -209,21 +254,26 @@ Without much prompting, @package :war@ picks the contents of the @src/main/webap
209
254
 
210
255
  Again, you can use the @include@ and @exclude@ methods to change the contents of the WAR. There are two convenience options you can use to make the more common changes. If you need to include a classes directory other than the default:
211
256
 
212
- {{{!ruby
257
+ <notextile>
258
+ {% highlight ruby %}
213
259
  package(:war).with :classes=>_('target/additional')
214
- }}}
260
+ {% endhighlight %}
261
+ </notextile>
215
262
 
216
263
  If you want to include a different set of libraries other than the default:
217
264
 
218
- {{{!ruby
265
+ <notextile>
266
+ {% highlight ruby %}
219
267
  package(:war).with :libs=>MYSQL_JDBC
220
- }}}
268
+ {% endhighlight %}
269
+ </notextile>
221
270
 
222
271
  Both options accept a single value or an array. The @:classes@ option accepts the name of a directory containing class files, initially set to @compile.target@ and @resources.target@. The @:libs@ option accepts artifact specifications, file names and tasks, initially set to include everything in @compile.dependencies@.
223
272
 
224
273
  As you can guess, the package task has two attributes called @classes@ and @libs@; the @with@ method merely sets their value. If you need more precise control over these arrays, you can always work with them directly, for example:
225
274
 
226
- {{{!ruby
275
+ <notextile>
276
+ {% highlight ruby %}
227
277
  # Add an artifact to the existing set:
228
278
  package(:war).libs += artifacts(MYSQL_JDBC)
229
279
  # Remove an artifact from the existing set:
@@ -231,17 +281,20 @@ package(:war).libs -= artifacts(LOG4J)
231
281
  # List all the artifacts:
232
282
  puts 'Artifacts included in WAR package:'
233
283
  puts package(:war).libs.map(&:to_spec)
234
- }}}
284
+ {% endhighlight %}
285
+ </notextile>
235
286
 
236
287
 
237
- h2. Packaging AARs
288
+ h2(#aar). Packaging AARs
238
289
 
239
290
  Axis2 service archives are similar to JAR's (compiled classes go into the root of the archive) but they can embed additional libraries under /lib and include @services.xml@ and WSDL files.
240
291
 
241
- {{{!ruby
292
+ <notextile>
293
+ {% highlight ruby %}
242
294
  package(:aar).with(:libs=>'log4j:log4j:jar:1.1')
243
295
  package(:aar).with(:services_xml=>_('target/services.xml'), :wsdls=>_('target/*.wsdl'))
244
- }}}
296
+ {% endhighlight %}
297
+ </notextile>
245
298
 
246
299
  The @libs@ attribute is a list of .jar artifacts to be included in the archive under /lib. The default is no artifacts; compile dependencies are not included by default.
247
300
 
@@ -251,17 +304,19 @@ The @wsdls@ attribute is a collection of file names or glob patterns for WSDL fi
251
304
 
252
305
  If you already have WSDL files in the @src/main/axis2@ directory but would like to perform some filtering, for example, to set the HTTP port number, consider ignoring the originals and including only the filtered files, for example:
253
306
 
254
- {{{!ruby
307
+ <notextile>
308
+ {% highlight ruby %}
255
309
  # Host name depends on environment.
256
310
  host = ENV['ENV'] == 'test' ? 'test.host' : 'ws.example.com'
257
311
  filter.from('src/main/axis2').into('target').
258
- include('services.xml', '*.wsdl').using('http_port'=>'8080', 'http_host'=>host)
312
+ include('services.xml', '==*==.wsdl').using('http_port'=>'8080', 'http_host'=>host)
259
313
  package(:aar).wsdls.clear
260
- package(:aar).with(:services_xml=>_('target/services.xml'), :wsdls=>_('target/*.wsdl'))
261
- }}}
314
+ package(:aar).with(:services_xml=>_('target/services.xml'), :wsdls=>_('target/==*==.wsdl'))
315
+ {% endhighlight %}
316
+ </notextile>
262
317
 
263
318
 
264
- h2. Packaging EARs
319
+ h2(#ear). Packaging EARs
265
320
 
266
321
  EAR packaging is slightly different from JAR/WAR packaging. It's main purpose is to package components together, and so it includes special methods for handling component inclusion that take care to update application.xml and the component's classpath.
267
322
 
@@ -275,35 +330,41 @@ EAR packages support four component types:
275
330
 
276
331
  This example shows two ways for adding components built by other projects:
277
332
 
278
- {{{!ruby
333
+ <notextile>
334
+ {% highlight ruby %}
279
335
  package(:ear) << project('coolWebService').package(:war)
280
336
  package(:ear).add project('commonLib') # By default, the JAR package
281
- }}}
337
+ {% endhighlight %}
338
+ </notextile>
282
339
 
283
340
  Adding a WAR package assumes it's a WAR component and treats it as such, but JAR packages can be any of three component types, so by default they are all treated as shared libraries. If you want to add an EJB or Application Client component, you need to say so explicitly, either passing @:type=>package@, or by passing the component type in the @:type@ option.
284
341
 
285
342
  Here are three examples:
286
343
 
287
- {{{!ruby
344
+ <notextile>
345
+ {% highlight ruby %}
288
346
  # Assumed to be a shared library.
289
347
  package(:ear).add 'org.springframework:spring:jar:2.6'
290
348
  # Component type mapped to package.
291
349
  package(:ear).add :ejb=>project('beanery')
292
350
  # Adding component with specific package type.
293
351
  package(:ear).add project('client'), :type=>:jar
294
- }}}
352
+ {% endhighlight %}
353
+ </notextile>
295
354
 
296
355
  By default, WAR components are all added under the @/war@ path, and likewise, EJB components are added under the @/ejb@ path, shared libraries under @/lib@ and Application Client components under @/jar@.
297
356
 
298
357
  If you want to place components in different locations you can do so using the @:path@ option, or by specifying a different mapping between component types and their destination directory. The following two examples are equivalent:
299
358
 
300
- {{{!ruby
359
+ <notextile>
360
+ {% highlight ruby %}
301
361
  # Specify once per component.
302
362
  package(:ear).add project('coolWebService').package(:war), :path=>'coolServices'
303
363
  # Configure once and apply to all added components.
304
364
  package(:ear).dirs[:war] = 'coolServices'
305
365
  package(:ear) << project('coolWebService').package(:war)
306
- }}}
366
+ {% endhighlight %}
367
+ </notextile>
307
368
 
308
369
  EAR packages include an @application.xml@ file in the @META-INF@ directory that describes the application and its components. This file is created for you during packaging, by referencing all the components added to the EAR. There are a couple of things you will typically want to change.
309
370
 
@@ -313,55 +374,67 @@ EAR packages include an @application.xml@ file in the @META-INF@ directory that
313
374
 
314
375
  Again, by example:
315
376
 
316
- {{{!ruby
377
+ <notextile>
378
+ {% highlight ruby %}
317
379
  package(:ear).display_name = 'MyCoolWebService'
318
380
  package(:ear).add project('coolWebService').package(:war), :context-root=>'coolness'
319
- }}}
381
+ {% endhighlight %}
382
+ </notextile>
320
383
 
321
384
  If you need to disable the context root (e.g. for Portlets), set @context_root@ to @false@.
322
385
 
323
386
 
324
- h2. Packaging Tars and GZipped Tars
387
+ h2(#tar). Packaging Tars and GZipped Tars
325
388
 
326
389
  Everything you know about working with ZIP files translates to Tar files, the two tasks are identical in more respect, so here we'll just go over the differences.
327
390
 
328
- {{{!ruby
391
+ <notextile>
392
+ {% highlight ruby %}
329
393
  package(:tar).include _('target/docs'), 'README'
330
394
  package(:tgz).include _('target/docs'), 'README'
331
- }}}
395
+ {% endhighlight %}
396
+ </notextile>
332
397
 
333
398
  The first line creates a Tar archive with the extension @.tar@, the second creates a GZipped Tar archive with the extension @.tgz@.
334
399
 
335
400
  In addition to packaging that includes the archive in the list of installed/released files, you can use the method @tar@ to create a @TarTask@. This task is similar to @ZipTask@, and introduces the @gzip@ attribute, which you can use to tell it whether to create a regular file, or GZip it. By default the attribute it set to true (GZip) if the file name ends with either @.gz@ or @.tgz@.
336
401
 
337
402
 
338
- h2. Installing and Uploading
403
+ h2(#install_upload). Installing and Uploading
339
404
 
340
405
  You can bring in the artifacts you need from remote repositories and install them in the local repositories. Other projects have the same expectation, that your packages be their artifacts.
341
406
 
342
407
  So let's create these packages and install them in the local repository where other projects can access them:
343
408
 
344
- {{{!sh
409
+ <notextile>
410
+ {% highlight sh %}
345
411
  $ buildr install
346
- }}}
412
+ {% endhighlight %}
413
+ </notextile>
347
414
 
348
415
  If you changes your mind you can always:
349
416
 
350
- {{{!sh
417
+ <notextile>
418
+ {% highlight sh %}
351
419
  $ buildr uninstall
352
- }}}
420
+ {% endhighlight %}
421
+ </notextile>
353
422
 
354
423
  That works between projects you build on the same machine. Now let's share these artifacts with other developers through a remote repository:
355
424
 
356
- {{{!sh
425
+ <notextile>
426
+ {% highlight sh %}
357
427
  $ buildr upload
358
- }}}
428
+ {% endhighlight %}
429
+ </notextile>
359
430
 
360
431
  Of course, you'll need to tell Buildr about the release server:
361
432
 
362
- {{{!ruby
433
+ <notextile>
434
+ {% highlight ruby %}
363
435
  repositories.release_to = 'sftp://john:secret@release/usr/share/repo'
364
- }}}
436
+ {% endhighlight %}
437
+ </notextile>
365
438
 
366
439
  This example uses the SFTP protocol. In addition, you can use the HTTP protocol -- Buildr supports HTTP and HTTPS, Basic Authentication and uploads using PUT -- or point to a directory on your file system.
367
440
 
@@ -369,59 +442,71 @@ The URL in this example contains the release server ("release"), path to reposit
369
442
 
370
443
  Of course, you'll want to specify the release server URL in the Buildfile, but leave the username/password settings private in your local @buildr.rb@ file. Let's break up the release server settings:
371
444
 
372
- {{{!ruby
445
+ <notextile>
446
+ {% highlight ruby %}
373
447
  # build.rb, loaded first
374
448
  repositories.release_to[:username] = 'john'
375
449
  repositories.release_to[:password] = 'secret'
376
450
 
377
451
  # Buildfile, loaded next
378
452
  repositories.release_to[:url] = 'sftp://release/usr/share/repo'
379
- }}}
453
+ {% endhighlight %}
454
+ </notextile>
380
455
 
381
456
  The @upload@ task takes care of uploading all the packages created by your project, along with their associated POM files and MD5/SHA1 signatures (Buildr creates these for you).
382
457
 
383
458
  If you need to upload other files, you can always extend the @upload@ task and use @repositories.release_to@ in combination with @URI.upload@. You can also extend it to upload to different servers, for example, to publish the documentation and test coverage reports to your site:
384
459
 
385
- {{{!ruby
460
+ <notextile>
461
+ {% highlight ruby %}
386
462
  # We'll let some other task decide how to create 'docs'
387
- task 'deploy'=>'docs' do
463
+ task 'upload'=>'docs' do
388
464
  uri = URI("sftp://#{username}:#{password}@var/www/docs")
389
465
  uri.upload file('docs')
390
466
  end
391
- }}}
467
+ {% endhighlight %}
468
+ </notextile>
392
469
 
393
470
 
394
- h2. Packaging Sources and JavaDocs
471
+ h2(#source_javadoc). Packaging Sources and JavaDocs
395
472
 
396
473
  IDEs can take advantage of source packages to help you debug and trace through compiled code. We'll start with a simple example:
397
474
 
398
- {{{!ruby
475
+ <notextile>
476
+ {% highlight ruby %}
399
477
  package :sources
400
- }}}
478
+ {% endhighlight %}
479
+ </notextile>
401
480
 
402
481
  This one creates a ZIP package with the classifier "sources" that will contain all the source directories in that project, typically @src/main/java@, but also other sources generated from Apt, JavaCC, XMLBeans and friends.
403
482
 
404
483
  You can also generate a ZIP package with the classifier "javadoc" that contains the JavaDoc documentation for the project. It uses the same set of documentation files generated by the project's @javadoc@ task, so you can use it in combination with the @javadoc@ method. For example:
405
484
 
406
- {{{!ruby
485
+ <notextile>
486
+ {% highlight ruby %}
407
487
  package :javadoc
408
488
  javadoc :windowtitle=>'Buggy but Works'
409
- }}}
489
+ {% endhighlight %}
490
+ </notextile>
410
491
 
411
492
  By default Buildr picks the project's description for the window title.
412
493
 
413
494
  You can also tell Buildr to automatically create sources and JavaDoc packages in all the sub-projects that have any source files to package or document. Just add either or both of these methods in the top-level project:
414
495
 
415
- {{{!ruby
496
+ <notextile>
497
+ {% highlight ruby %}
416
498
  package_with_sources
417
499
  package_with_javadoc
418
- }}}
500
+ {% endhighlight %}
501
+ </notextile>
419
502
 
420
503
  You can also tell it to be selective using the @:only@ and @:except@ options.
421
504
  For example:
422
505
 
423
- {{{!ruby
506
+ <notextile>
507
+ {% highlight ruby %}
424
508
  package_with_javadoc :except=>'la-web'
425
- }}}
509
+ {% endhighlight %}
510
+ </notextile>
426
511
 
427
512
  We packaged the code, but will it actually work? Let's see "what the tests say":testing.html.