buildr 1.2.10 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/CHANGELOG +566 -268
  2. data/DISCLAIMER +7 -1
  3. data/KEYS +151 -0
  4. data/NOTICE +23 -8
  5. data/README +122 -22
  6. data/Rakefile +49 -229
  7. data/{lib → addon}/buildr/antlr.rb +23 -10
  8. data/addon/buildr/cobertura.rb +232 -0
  9. data/{lib → addon}/buildr/hibernate.rb +20 -4
  10. data/{lib → addon}/buildr/javacc.rb +27 -12
  11. data/addon/buildr/jdepend.rb +60 -0
  12. data/{lib → addon}/buildr/jetty.rb +34 -18
  13. data/addon/buildr/nailgun.rb +892 -0
  14. data/{lib → addon}/buildr/openjpa.rb +23 -6
  15. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  16. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  17. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  18. data/{lib/buildr/jetty → addon/buildr/org/apache/buildr}/JettyWrapper.java +19 -0
  19. data/{lib → addon}/buildr/xmlbeans.rb +39 -14
  20. data/bin/buildr +21 -7
  21. data/buildr.gemspec +50 -0
  22. data/doc/css/default.css +225 -0
  23. data/doc/css/print.css +95 -0
  24. data/doc/css/syntax.css +43 -0
  25. data/doc/images/apache-incubator-logo.png +0 -0
  26. data/doc/images/buildr-hires.png +0 -0
  27. data/doc/images/buildr.png +0 -0
  28. data/doc/images/note.png +0 -0
  29. data/doc/images/tip.png +0 -0
  30. data/doc/images/zbuildr.tif +0 -0
  31. data/doc/pages/artifacts.textile +317 -0
  32. data/doc/pages/building.textile +501 -0
  33. data/doc/pages/contributing.textile +178 -0
  34. data/doc/pages/download.textile +25 -0
  35. data/doc/pages/extending.textile +229 -0
  36. data/doc/pages/getting_started.textile +337 -0
  37. data/doc/pages/index.textile +63 -0
  38. data/doc/pages/mailing_lists.textile +17 -0
  39. data/doc/pages/more_stuff.textile +367 -0
  40. data/doc/pages/packaging.textile +592 -0
  41. data/doc/pages/projects.textile +449 -0
  42. data/doc/pages/recipes.textile +127 -0
  43. data/doc/pages/settings_profiles.textile +339 -0
  44. data/doc/pages/testing.textile +475 -0
  45. data/doc/pages/troubleshooting.textile +121 -0
  46. data/doc/pages/whats_new.textile +389 -0
  47. data/doc/print.haml +52 -0
  48. data/doc/print.toc.yaml +28 -0
  49. data/doc/scripts/buildr-git.rb +411 -0
  50. data/doc/scripts/install-jruby.sh +44 -0
  51. data/doc/scripts/install-linux.sh +64 -0
  52. data/doc/scripts/install-osx.sh +52 -0
  53. data/doc/site.haml +55 -0
  54. data/doc/site.toc.yaml +44 -0
  55. data/lib/buildr.rb +28 -45
  56. data/lib/buildr/core.rb +27 -0
  57. data/lib/buildr/core/application.rb +373 -0
  58. data/lib/buildr/core/application_cli.rb +134 -0
  59. data/lib/{core → buildr/core}/build.rb +91 -77
  60. data/lib/{core → buildr/core}/checks.rb +116 -95
  61. data/lib/buildr/core/common.rb +155 -0
  62. data/lib/buildr/core/compile.rb +594 -0
  63. data/lib/buildr/core/environment.rb +120 -0
  64. data/lib/buildr/core/filter.rb +258 -0
  65. data/lib/{core → buildr/core}/generate.rb +22 -5
  66. data/lib/buildr/core/help.rb +118 -0
  67. data/lib/buildr/core/progressbar.rb +156 -0
  68. data/lib/{core → buildr/core}/project.rb +468 -213
  69. data/lib/buildr/core/test.rb +690 -0
  70. data/lib/{core → buildr/core}/transports.rb +107 -127
  71. data/lib/buildr/core/util.rb +235 -0
  72. data/lib/buildr/ide.rb +19 -0
  73. data/lib/{java → buildr/ide}/eclipse.rb +86 -60
  74. data/lib/{java → buildr/ide}/idea.ipr.template +16 -0
  75. data/lib/buildr/ide/idea.rb +194 -0
  76. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  77. data/lib/buildr/ide/idea7x.rb +210 -0
  78. data/lib/buildr/java.rb +26 -0
  79. data/lib/buildr/java/ant.rb +71 -0
  80. data/lib/buildr/java/bdd_frameworks.rb +267 -0
  81. data/lib/buildr/java/commands.rb +210 -0
  82. data/lib/buildr/java/compilers.rb +432 -0
  83. data/lib/buildr/java/deprecated.rb +141 -0
  84. data/lib/buildr/java/groovyc.rb +137 -0
  85. data/lib/buildr/java/jruby.rb +99 -0
  86. data/lib/buildr/java/org/apache/buildr/BuildrNail$Main.class +0 -0
  87. data/lib/buildr/java/org/apache/buildr/BuildrNail.class +0 -0
  88. data/lib/buildr/java/org/apache/buildr/BuildrNail.java +41 -0
  89. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  90. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +116 -0
  91. data/lib/buildr/java/packaging.rb +706 -0
  92. data/lib/{java → buildr/java}/pom.rb +20 -4
  93. data/lib/buildr/java/rjb.rb +142 -0
  94. data/lib/buildr/java/test_frameworks.rb +290 -0
  95. data/lib/buildr/java/version_requirement.rb +172 -0
  96. data/lib/buildr/packaging.rb +21 -0
  97. data/lib/{java → buildr/packaging}/artifact.rb +170 -179
  98. data/lib/buildr/packaging/artifact_namespace.rb +957 -0
  99. data/lib/buildr/packaging/artifact_search.rb +140 -0
  100. data/lib/buildr/packaging/gems.rb +102 -0
  101. data/lib/buildr/packaging/package.rb +233 -0
  102. data/lib/{tasks → buildr/packaging}/tar.rb +18 -1
  103. data/lib/{tasks → buildr/packaging}/zip.rb +153 -105
  104. data/rakelib/apache.rake +126 -0
  105. data/rakelib/changelog.rake +56 -0
  106. data/rakelib/doc.rake +103 -0
  107. data/rakelib/package.rake +44 -0
  108. data/rakelib/release.rake +53 -0
  109. data/rakelib/rspec.rake +81 -0
  110. data/rakelib/rubyforge.rake +45 -0
  111. data/rakelib/scm.rake +49 -0
  112. data/rakelib/setup.rake +59 -0
  113. data/rakelib/stage.rake +45 -0
  114. data/spec/application_spec.rb +316 -0
  115. data/spec/archive_spec.rb +494 -0
  116. data/spec/artifact_namespace_spec.rb +635 -0
  117. data/spec/artifact_spec.rb +738 -0
  118. data/spec/build_spec.rb +193 -0
  119. data/spec/checks_spec.rb +537 -0
  120. data/spec/common_spec.rb +579 -0
  121. data/spec/compile_spec.rb +561 -0
  122. data/spec/groovy_compilers_spec.rb +239 -0
  123. data/spec/java_bdd_frameworks_spec.rb +238 -0
  124. data/spec/java_compilers_spec.rb +446 -0
  125. data/spec/java_packaging_spec.rb +1042 -0
  126. data/spec/java_test_frameworks_spec.rb +414 -0
  127. data/spec/packaging_helper.rb +63 -0
  128. data/spec/packaging_spec.rb +589 -0
  129. data/spec/project_spec.rb +739 -0
  130. data/spec/sandbox.rb +116 -0
  131. data/spec/scala_compilers_spec.rb +239 -0
  132. data/spec/spec.opts +6 -0
  133. data/spec/spec_helpers.rb +283 -0
  134. data/spec/test_spec.rb +871 -0
  135. data/spec/transport_spec.rb +300 -0
  136. data/spec/version_requirement_spec.rb +115 -0
  137. metadata +188 -77
  138. data/lib/buildr/cobertura.rb +0 -89
  139. data/lib/buildr/jdepend.rb +0 -40
  140. data/lib/buildr/jetty/JettyWrapper$1.class +0 -0
  141. data/lib/buildr/jetty/JettyWrapper$BuildrHandler.class +0 -0
  142. data/lib/buildr/jetty/JettyWrapper.class +0 -0
  143. data/lib/buildr/scala.rb +0 -368
  144. data/lib/core/application.rb +0 -188
  145. data/lib/core/common.rb +0 -562
  146. data/lib/core/help.rb +0 -72
  147. data/lib/core/rake_ext.rb +0 -81
  148. data/lib/java/ant.rb +0 -71
  149. data/lib/java/compile.rb +0 -589
  150. data/lib/java/idea.rb +0 -159
  151. data/lib/java/java.rb +0 -432
  152. data/lib/java/packaging.rb +0 -581
  153. data/lib/java/test.rb +0 -795
  154. data/lib/tasks/concat.rb +0 -35
@@ -0,0 +1,95 @@
1
+ /* Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with this
3
+ * work for additional information regarding copyright ownership. The ASF
4
+ * licenses this file to you under the Apache License, Version 2.0 (the
5
+ * "License"); you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ * License for the specific language governing permissions and limitations
14
+ * under the License.
15
+ */
16
+
17
+
18
+ @page { margin: 1in 0.75in 1in 0.75in; }
19
+ @page {
20
+ font-family: "DejaVu Sans", Verdana, Helvetica;
21
+ }
22
+ @page:left {
23
+ @top-left { content: counter(page); }
24
+ @top-right { content: string(pagetitle); }
25
+ }
26
+ @page:right {
27
+ @top-left { content: string(pagetitle); }
28
+ @top-right { content: counter(page); }
29
+ }
30
+ @page:first {
31
+ @top-left { content: normal }
32
+ @top-right { content: normal }
33
+ }
34
+
35
+ title {
36
+ string-set: doctitle content();
37
+ }
38
+
39
+ body {
40
+ font-size: 12pt;
41
+ margin: 0;
42
+ color: black;
43
+ background: white;
44
+ }
45
+
46
+ h1 {
47
+ string-set: pagetitle content();
48
+ page-break-before: always;
49
+ }
50
+ h1:first-child { page-break-before: avoid; }
51
+ pre, p, blockquote { page-break-inside: avoid; }
52
+ pre {
53
+ line-height: 1.3em;
54
+ white-space: pre-wrap; /* css-3 */
55
+ padding: 0.3em 0 0.9em 0.6em;
56
+ margin: 0;
57
+ }
58
+ a:link, a:visited {
59
+ background: transparent;
60
+ text-decoration: none;
61
+ }
62
+
63
+
64
+ #wrap, #content, #footer {
65
+ float: none !important;
66
+ color: black;
67
+ background: transparent;
68
+ width: auto !important;
69
+ margin: 0;
70
+ padding: 0;
71
+ border: 0;
72
+ }
73
+
74
+ #header {
75
+ margin-bottom: 5%;
76
+ font-size: 120%;
77
+ }
78
+ #header img { width: 4in; }
79
+ #header .tagline {
80
+ float: none !important;
81
+ position: static !important;
82
+ font-size: 1.2em;
83
+ text-align: center;
84
+ }
85
+
86
+ #pages, .noprint { display: none; }
87
+
88
+ ol.toc a:link, ol.toc a:visited { text-decoration: none; }
89
+ ol.toc a:after { content: leader('.') target-counter(attr(href), page); }
90
+
91
+ #footer { margin-top: 5%; }
92
+
93
+ #license {
94
+ padding-top: 1in;
95
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * From Syntax, Copyright © 2005 Jamis Buck
3
+ */
4
+
5
+ .ruby .normal {}
6
+ .ruby .comment { color: #7f7f7f; }
7
+ .ruby .keyword { color: #153582; font-weight: bold; }
8
+ .ruby .method { color: #066; }
9
+ .ruby .class { color: #074; }
10
+ .ruby .module { color: #050; }
11
+ .ruby .punct { color: #447; font-weight: bold; }
12
+ .ruby .symbol { color: #099; }
13
+ .ruby .string { color: #944; background: #FFE; }
14
+ .ruby .char { color: #F07; }
15
+ .ruby .ident { color: #004; }
16
+ .ruby .constant { color: #07F; }
17
+ .ruby .regex { color: #B66; background: #FEF; }
18
+ .ruby .number { color: #F99; }
19
+ .ruby .attribute { color: #7BB; }
20
+ .ruby .global { color: #7FB; }
21
+ .ruby .expr { color: #227; }
22
+ .ruby .escape { color: #277; }
23
+
24
+ .xml .normal {}
25
+ .xml .namespace { color: #B66; font-weight: bold; }
26
+ .xml .tag { color: #4c00ff; }
27
+ .xml .comment { color: #7f7f7f; }
28
+ .xml .punct { color: #447; font-weight: bold; }
29
+ .xml .string { color: #944; }
30
+ .xml .number { color: #F99; }
31
+ .xml .attribute { color: #BB7; }
32
+
33
+ .yaml .document { }
34
+ .yaml .type { }
35
+ .yaml .key { color: #4c00ff}
36
+ .yaml .comment { color: #7f7f7f; }
37
+ .yaml .punct { }
38
+ .yaml .string { }
39
+ .yaml .number { }
40
+ .yaml .time { }
41
+ .yaml .date { }
42
+ .yaml .ref { color: #00c0c0 }
43
+ .yaml .anchor { color: #00c0c0 }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,317 @@
1
+ h1. Artifacts
2
+
3
+ In Buildr, almost everything is a file or a file task. You compile source files
4
+ that come from the file system using dependencies found on the file system,
5
+ generating even more files. But how do you get these dependencies to start
6
+ with, and how do you share them with others?
7
+
8
+ Artifacts. We designed Buildr to work as a drop-in replacement for Maven 2.0,
9
+ and share artifacts through the same local and remote repositories. Artifact
10
+ tasks know how to download a file from one of the remote repositories, and
11
+ install it in the local repository, where Buildr can find it. Packages know how
12
+ to create files and upload them to remote repositories.
13
+
14
+ We'll get into all of that in a second, but first, let's introduce the artifact
15
+ specification. It's a simple string that takes one of two forms:
16
+
17
+ {{{
18
+ group:id:type:version
19
+ group:id:type:classifier:version
20
+ }}}
21
+
22
+ For example, @'org.apache.axis2:axis2:jar:1.2'@ refers to an artifact with
23
+ group identifier org.apache.axis2, artifact identifier axis2, a JAR file with
24
+ version 1.2. Classifiers are typically used to distinguish between similar
25
+ file types, for example, a source distribution and a binary distribution that
26
+ otherwise have the same identifier and are both ZIP files.
27
+
28
+
29
+ h2. Specifying Artifacts
30
+
31
+ If your Buildfile spells out @'org.apache.axis2:axis2:jar:1.2'@ more than once,
32
+ you're doing something wrong. Repeating the same string over and over will
33
+ make your code harder to maintain. You'll know that when you upgrade to a new
34
+ version in one place, forget to do it in another, and end up with a mismatch.
35
+
36
+ You can use Ruby's syntax to do simple string substitution, for example:
37
+
38
+ {{{!ruby
39
+ AXIS_VERSION = '1.2'
40
+
41
+ compile.with "org.apache.axis2:axis2:jar:#{AXIS_VERSION}"
42
+ }}}
43
+
44
+ Better yet, you can define all your artifacts at the top of the Buildfile and
45
+ use constants to reference them in your project definition. For example:
46
+
47
+ {{{!ruby
48
+ AXIS2 = 'org.apache.axis2:axis2:jar:1.2'
49
+
50
+ compile.with AXIS2
51
+ }}}
52
+
53
+ Note that we're not using a separate constant for the version number. In our
54
+ experience, it's unnecessary. The version number intentionally appears at the
55
+ end of the string, where it stands out easily.
56
+
57
+ If you have a set of artifacts that belong to the same group and version, and
58
+ that's quite common, you can use the @group@ shortcut:
59
+
60
+ {{{!ruby
61
+ AXIOM = group('axiom-api', 'axiom-impl', 'axiom-dom',
62
+ :under=>'org.apache.ws.commons.axiom', :version=>'1.2.4')
63
+ }}}
64
+
65
+ p(note). Buildr projects also define a @group@ attribute which can lead to
66
+ some confusion. If you want to define an artifact group within a project
67
+ definition, you should use the explicit qualifier @Buildr::group@.
68
+
69
+ If you have several artifacts you always use together, consider placing them in
70
+ an array. Methods that accept lists of artifacts also accept arrays. For
71
+ example:
72
+
73
+ {{{!ruby
74
+ OPENJPA = ['org.apache.openjpa:openjpa-all:jar:0.9.7',
75
+ 'net.sourceforge.serp:serp:jar:1.12.0']
76
+ AXIS_OF_WS = [AXIS2, AXIOM]
77
+
78
+ compile.with OPENJPA, AXIS_OF_WS
79
+ }}}
80
+
81
+ Another way to group related artifacts together and access them individually is
82
+ using the @struct@ shortcut. For example:
83
+
84
+ {{{!ruby
85
+ JAVAX = struct(
86
+ :activation =>'javax.activation:activation:jar:1.1',
87
+ :persistence =>'javax.persistence:persistence-api:jar:1.0',
88
+ :stream =>'stax:stax-api:jar:1.0.1',
89
+ )
90
+
91
+ compile.with JAVAX.persistence, OPENJPA
92
+ }}}
93
+
94
+ In our experience, using constants in this manner makes your Buildfile much
95
+ easier to write and maintain.
96
+
97
+ And, of course, you can always place your artifact specifications in a separate
98
+ file and require it into your Buildfile. For example, if you're working on
99
+ several different projects that all share the same artifacts:
100
+
101
+ {{{!ruby
102
+ require '../shared/artifacts'
103
+ }}}
104
+
105
+ When you use @require@, Ruby always looks for a filename with the @.rb@
106
+ extension, so in this case it expects to find @artifacts.rb@ in the @shared@
107
+ directory.
108
+
109
+ One last thing. You can also treat artifact specifications as hashes. For
110
+ example:
111
+
112
+ {{{!ruby
113
+ AXIS = { :group=>'org.apache.axis2', :id=>'axis2', :version=>'1.2' }
114
+ compile.with AXIS
115
+ puts compile.dependencies.first.to_hash
116
+ => { :group=>'org.apache.axis2', :id=>'axis2',
117
+ :version=>'1.2', :type=>:jar }
118
+ }}}
119
+
120
+
121
+ h2. Specifying Repositories
122
+
123
+ Buildr can download artifacts for you, but only if you tell it where to find
124
+ them. You need to specify at least one remote repository, from which to
125
+ download these artifacts.
126
+
127
+ When you call @repositories.remote@, you get an array of URLs for the various
128
+ remote repositories. Initially, it's an empty array, to which you can add new
129
+ repositories. For example:
130
+
131
+ {{{!ruby
132
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
133
+ }}}
134
+
135
+ If you need to use a proxy server to access remote repositories, you can set
136
+ the environment variable @HTTP_PROXY@ to the proxy server URL. You can also
137
+ work without a proxy for certain hosts by specifying the @NO_PROXY@ environment
138
+ variable. For example:
139
+
140
+ {{{!sh
141
+ $ export HTTP_PROXY = 'http://myproxy:8080'
142
+ $ export NO_PROXY = '*.mycompany.com,localhost,special:800'
143
+ }}}
144
+
145
+ Alternatively you can use the Buildr options @proxy.http@ and @proxy.exclude@:
146
+
147
+ {{{!ruby
148
+ options.proxy.http = 'http://myproxy:8080'
149
+ options.proxy.exclude << '*.mycompany.com'
150
+ options.proxy.exclude << 'localhost'
151
+ }}}
152
+
153
+ All the artifacts download into the local repository. Since all your projects
154
+ share the same local repository, you only need to download each artifact once.
155
+ Buildr was designed to be used alongside Maven 2.0, for example, when migrating
156
+ projects from Maven 2.0 over to Buildr. By default it will share the same
157
+ local repository, expecting the repository to be the @.m2/repository@ directory
158
+ inside your home directory.
159
+
160
+ You can choose to relocate the local repository by giving it a different path,
161
+ for example:
162
+
163
+ {{{!ruby
164
+ repositories.local = '/usr/local/maven/repository'
165
+ }}}
166
+
167
+ That's one change you don't want to commit into the Buildfile, so the best
168
+ place to do it is in your home directory's @buildr.rb@ file.
169
+
170
+ Buildr downloads artifacts when it needs to use them, for example, to compile a
171
+ project. You don't need to download artifacts directly. Except when you do,
172
+ for example, if you want to download all the latest artifacts and then go
173
+ off-line. It's as simple as:
174
+
175
+ {{{!sh
176
+ $ buildr artifacts
177
+ }}}
178
+
179
+
180
+ h2. Downloading Artifacts
181
+
182
+ Within your buildfile you can download artifacts directly by invoking them, for
183
+ example:
184
+
185
+ {{{!ruby
186
+ artifact('org.apache.openjpa:openjpa-all:jar:0.9.7').invoke
187
+ artifacts(OPENJPA).each(&:invoke)
188
+ }}}
189
+
190
+ When you let Buildr download artifacts for you, or by invoking the artifact
191
+ task yourself, it scans through the remote repositories assuming each
192
+ repository follows the Maven 2 structure. Starting from the root repository
193
+ URL, it will look for each artifact using the path
194
+ @group/id/version/id-version.type@ (or ...@/id-version-classifier.type@). The
195
+ group identifier becomes a path by turning periods (@.@) into slashes (@/@).
196
+ So to find @org.apache.axis2:axis2:jar:1.2@, we're going to look for
197
+ @org/apache/axis2/axis2/1.2/axis2-1.2.jar@.
198
+
199
+ You'll find a lot of open source Java libraries in public repositories that
200
+ support this structure (for example, the "Ibiblio
201
+ Maven":http://www.ibiblio.org/maven2/ repository). And, of course, every
202
+ remote repository you setup for your projects.
203
+
204
+ But there are exceptions to the rule. Say we want to download the Dojo widget
205
+ library and use it in our project. It's available from the Dojo Web site, but
206
+ that site doesn't follow the Maven repository conventions, so our feeble
207
+ attempt to use existing remote repositories will fail.
208
+
209
+ We can still treat Dojo as an artifact, by telling Buildr where to download it
210
+ from:
211
+
212
+ {{{!ruby
213
+ DOJO = '0.2.2'
214
+
215
+ url = "http://download.dojotoolkit.org/release-#{DOJO}/dojo-#{DOJO}-widget.zip"
216
+ download(artifact("dojo:dojo:zip:widget:#{DOJO}")=>url)
217
+ }}}
218
+
219
+ Explaining how it works is tricky, skip if you don't care for the details. On
220
+ the other hand, it will give you a better understanding of Buildr/Rake, so if
221
+ not now, come back and read it later.
222
+
223
+ We use the @artifact@ method to create an @Artifact@ task that references the
224
+ Dojo widget in our local repository. The @Artifact@ task is a file task with
225
+ some additional behavior added by Buildr. When you call @compile.with@, that's
226
+ exactly what it does internally, turning each of your artifact specifications
227
+ into an @Artifact@ task.
228
+
229
+ But the @Artifact@ task doesn't know how to download the Dojo widget, only how
230
+ to handle conventional repositories. So we're going to create a download task
231
+ as well. We use the @download@ method to create a file task that downloads the
232
+ file from a remote URL. (Of course, it will only download the file if it
233
+ doesn't already exist.)
234
+
235
+ But which task gets used when? We could have defined these tasks separately
236
+ and used some glue code to make one use the other. Instead, we call @download@
237
+ with the results of @artifact@. Essentially, we're telling @download@ to use
238
+ the same file path as @artifact@. So now we have two file tasks that point to
239
+ the very same file. We wired them together.
240
+
241
+ You can't have more than one task pointing to the same file. Rake's rule of
242
+ the road. What Rake does is merge the tasks together, creating a single file
243
+ task for @artifact@, and then enhancing it with another action from @download@.
244
+ One task, two actions. Statistically, we've doubled the odds that at least one
245
+ of these actions will manage to download the Dojo widget and install it in the
246
+ local repository.
247
+
248
+ Since we ordered the calls to @artifact@ first and @download@ second, we know
249
+ the actions will execute in that order. But @artifact@ is slightly devilish:
250
+ when its action runs, it adds another action to the end of the list. So the
251
+ @artifact@ action runs first, adds an action at the end, the @download@ action
252
+ runs second, and downloads the Dojo widget for us. The second @artifact@
253
+ action runs last, but checks that the file already exist and doesn't try to
254
+ download it again.
255
+
256
+ Magic.
257
+
258
+
259
+ h2. Install and Upload
260
+
261
+ Generally you use artifacts that download from remote repositories into the
262
+ local repository, or artifacts packaged by the project itself (see
263
+ "Packaging":packaging.html), which are then installed into the local repository
264
+ and uploaded to the release server.
265
+
266
+ Some artifacts do not fall into either category. In this example we're going
267
+ to download a ZIP file, extract a JAR file from it, and use that JAR file as an
268
+ artifact. We would then expect to install this JAR in the local repository and
269
+ upload it to the release server, where it can be shared with other projects.
270
+
271
+ So let's start by creating a task that downloads the ZIP, and another one to
272
+ extract it and create the JAR file:
273
+
274
+ {{{!ruby
275
+ app_zip = download('target/app.zip'=>url)
276
+ bean_jar = file('target/app/bean.jar'=>unzip('target/app'=>app_zip))
277
+ }}}
278
+
279
+ When you call @artifact@, it returns an @Artifact@ task that points to the
280
+ artifact file in the local repository, downloading the file if it doesn't
281
+ already exist. You can override this behavior by enhancing the task and
282
+ creating the file yourself (you may also want to create a POM file). Or much
283
+ simpler, call the @from@ method on the artifact and tell it where to find the
284
+ source file.
285
+
286
+ So the next step is to specify the artifact and tell it to use the extracted
287
+ JAR file:
288
+
289
+ {{{!ruby
290
+ bean = artifact('example.com:beans:jar:1.0').from(bean_jar)
291
+ }}}
292
+
293
+ The artifact still points to the local repository, but when we invoke the task
294
+ it copies the source file over to the local repository, instead of attempting a
295
+ download.
296
+
297
+ Use the @install@ method if you want the artifact and its POM installed in the
298
+ local repository when you run the @install@ task. Likewise, use the @upload@
299
+ method if you want the artifact uploaded to the release server when you run the
300
+ @upload@ task. You do not need to do this on artifacts downloaded from a
301
+ remote server, or created with the @package@ method, the later are
302
+ automatically added to the list of installed/uploaded artifacts.
303
+
304
+ Our example ends by including the artifact in the @install@ and @upload@ tasks:
305
+
306
+ {{{!ruby
307
+ install bean
308
+ upload bean
309
+ }}}
310
+
311
+ p(tip). Calling the @install@ (and likewise @upload@) method on an artifact
312
+ does not install the artifact, it simply adds a task that will execute when you
313
+ run @buildr install@. If you need to download and install an artifact, invoke
314
+ the task directly with @install(<artifact>).invoke@.
315
+
316
+
317
+ Next we're going to "package some artifacts":packaging.html.