buildr 1.3.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +998 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +45 -0
  6. data/_buildr +29 -0
  7. data/_jbuildr +29 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +22 -0
  10. data/addon/buildr/drb.rb +281 -0
  11. data/addon/buildr/emma.rb +22 -0
  12. data/addon/buildr/hibernate.rb +142 -0
  13. data/addon/buildr/javacc.rb +85 -0
  14. data/addon/buildr/jdepend.rb +60 -0
  15. data/addon/buildr/jetty.rb +248 -0
  16. data/addon/buildr/jibx.rb +86 -0
  17. data/addon/buildr/nailgun.rb +221 -0
  18. data/addon/buildr/openjpa.rb +90 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  26. data/addon/buildr/xmlbeans.rb +93 -0
  27. data/bin/buildr +19 -0
  28. data/buildr.buildfile +58 -0
  29. data/buildr.gemspec +65 -0
  30. data/doc/_config.yml +1 -0
  31. data/doc/_layouts/default.html +88 -0
  32. data/doc/_layouts/preface.html +22 -0
  33. data/doc/artifacts.textile +211 -0
  34. data/doc/building.textile +244 -0
  35. data/doc/contributing.textile +252 -0
  36. data/doc/css/default.css +236 -0
  37. data/doc/css/print.css +101 -0
  38. data/doc/css/syntax.css +23 -0
  39. data/doc/download.textile +79 -0
  40. data/doc/extending.textile +186 -0
  41. data/doc/images/1442160941-frontcover.jpg +0 -0
  42. data/doc/images/asf-logo.gif +0 -0
  43. data/doc/images/asf-logo.png +0 -0
  44. data/doc/images/buildr-hires.png +0 -0
  45. data/doc/images/buildr.png +0 -0
  46. data/doc/images/favicon.png +0 -0
  47. data/doc/images/growl-icon.tiff +0 -0
  48. data/doc/images/note.png +0 -0
  49. data/doc/images/project-structure.png +0 -0
  50. data/doc/images/tip.png +0 -0
  51. data/doc/images/zbuildr.png +0 -0
  52. data/doc/images/zbuildr.tif +0 -0
  53. data/doc/index.textile +69 -0
  54. data/doc/installing.textile +266 -0
  55. data/doc/languages.textile +459 -0
  56. data/doc/mailing_lists.textile +25 -0
  57. data/doc/more_stuff.textile +457 -0
  58. data/doc/packaging.textile +430 -0
  59. data/doc/preface.textile +54 -0
  60. data/doc/projects.textile +271 -0
  61. data/doc/quick_start.textile +210 -0
  62. data/doc/scripts/buildr-git.rb +512 -0
  63. data/doc/scripts/gitflow.rb +296 -0
  64. data/doc/scripts/install-jruby.sh +44 -0
  65. data/doc/scripts/install-linux.sh +72 -0
  66. data/doc/scripts/install-osx.sh +52 -0
  67. data/doc/settings_profiles.textile +280 -0
  68. data/doc/testing.textile +222 -0
  69. data/etc/KEYS +151 -0
  70. data/lib/buildr.rb +36 -0
  71. data/lib/buildr/core.rb +35 -0
  72. data/lib/buildr/core/application.rb +656 -0
  73. data/lib/buildr/core/build.rb +452 -0
  74. data/lib/buildr/core/checks.rb +254 -0
  75. data/lib/buildr/core/common.rb +150 -0
  76. data/lib/buildr/core/compile.rb +608 -0
  77. data/lib/buildr/core/environment.rb +129 -0
  78. data/lib/buildr/core/filter.rb +362 -0
  79. data/lib/buildr/core/generate.rb +195 -0
  80. data/lib/buildr/core/help.rb +119 -0
  81. data/lib/buildr/core/osx.rb +46 -0
  82. data/lib/buildr/core/progressbar.rb +156 -0
  83. data/lib/buildr/core/project.rb +866 -0
  84. data/lib/buildr/core/shell.rb +198 -0
  85. data/lib/buildr/core/test.rb +723 -0
  86. data/lib/buildr/core/transports.rb +559 -0
  87. data/lib/buildr/core/util.rb +449 -0
  88. data/lib/buildr/groovy.rb +19 -0
  89. data/lib/buildr/groovy/bdd.rb +106 -0
  90. data/lib/buildr/groovy/compiler.rb +138 -0
  91. data/lib/buildr/groovy/shell.rb +48 -0
  92. data/lib/buildr/ide.rb +19 -0
  93. data/lib/buildr/ide/eclipse.rb +334 -0
  94. data/lib/buildr/ide/eclipse/java.rb +53 -0
  95. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  96. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  97. data/lib/buildr/ide/idea.ipr.template +300 -0
  98. data/lib/buildr/ide/idea.rb +190 -0
  99. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  100. data/lib/buildr/ide/idea7x.rb +212 -0
  101. data/lib/buildr/java.rb +23 -0
  102. data/lib/buildr/java/ant.rb +94 -0
  103. data/lib/buildr/java/bdd.rb +459 -0
  104. data/lib/buildr/java/cobertura.rb +274 -0
  105. data/lib/buildr/java/commands.rb +213 -0
  106. data/lib/buildr/java/compiler.rb +349 -0
  107. data/lib/buildr/java/deprecated.rb +141 -0
  108. data/lib/buildr/java/emma.rb +244 -0
  109. data/lib/buildr/java/jruby.rb +117 -0
  110. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  111. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  112. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +137 -0
  113. data/lib/buildr/java/packaging.rb +716 -0
  114. data/lib/buildr/java/pom.rb +174 -0
  115. data/lib/buildr/java/rjb.rb +155 -0
  116. data/lib/buildr/java/test_result.rb +353 -0
  117. data/lib/buildr/java/tests.rb +333 -0
  118. data/lib/buildr/java/version_requirement.rb +172 -0
  119. data/lib/buildr/packaging.rb +24 -0
  120. data/lib/buildr/packaging/archive.rb +488 -0
  121. data/lib/buildr/packaging/artifact.rb +749 -0
  122. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  123. data/lib/buildr/packaging/artifact_search.rb +140 -0
  124. data/lib/buildr/packaging/gems.rb +102 -0
  125. data/lib/buildr/packaging/package.rb +238 -0
  126. data/lib/buildr/packaging/tar.rb +186 -0
  127. data/lib/buildr/packaging/version_requirement.rb +172 -0
  128. data/lib/buildr/packaging/zip.rb +73 -0
  129. data/lib/buildr/packaging/ziptask.rb +316 -0
  130. data/lib/buildr/resources/buildr.icns +0 -0
  131. data/lib/buildr/scala.rb +25 -0
  132. data/lib/buildr/scala/bdd.rb +109 -0
  133. data/lib/buildr/scala/compiler.rb +195 -0
  134. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  135. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  136. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  137. data/lib/buildr/scala/shell.rb +55 -0
  138. data/lib/buildr/scala/tests.rb +157 -0
  139. data/lib/buildr/shell.rb +180 -0
  140. data/rakelib/checks.rake +57 -0
  141. data/rakelib/doc.rake +92 -0
  142. data/rakelib/jekylltask.rb +120 -0
  143. data/rakelib/package.rake +73 -0
  144. data/rakelib/release.rake +149 -0
  145. data/rakelib/rspec.rake +73 -0
  146. data/rakelib/setup.rake +54 -0
  147. data/rakelib/stage.rake +213 -0
  148. data/rakelib/stage.rake~ +213 -0
  149. data/spec/addon/drb_spec.rb +328 -0
  150. data/spec/core/application_spec.rb +502 -0
  151. data/spec/core/build_spec.rb +677 -0
  152. data/spec/core/checks_spec.rb +519 -0
  153. data/spec/core/common_spec.rb +670 -0
  154. data/spec/core/compile_spec.rb +583 -0
  155. data/spec/core/extension_spec.rb +93 -0
  156. data/spec/core/generate_spec.rb +33 -0
  157. data/spec/core/project_spec.rb +762 -0
  158. data/spec/core/test_spec.rb +1098 -0
  159. data/spec/core/transport_spec.rb +537 -0
  160. data/spec/core/util_spec.rb +67 -0
  161. data/spec/groovy/bdd_spec.rb +80 -0
  162. data/spec/groovy/compiler_spec.rb +240 -0
  163. data/spec/ide/eclipse_spec.rb +501 -0
  164. data/spec/ide/idea7x_spec.rb +84 -0
  165. data/spec/java/ant_spec.rb +33 -0
  166. data/spec/java/bdd_spec.rb +382 -0
  167. data/spec/java/cobertura_spec.rb +85 -0
  168. data/spec/java/compiler_spec.rb +446 -0
  169. data/spec/java/emma_spec.rb +119 -0
  170. data/spec/java/java_spec.rb +124 -0
  171. data/spec/java/packaging_spec.rb +1134 -0
  172. data/spec/java/test_coverage_helper.rb +257 -0
  173. data/spec/java/tests_spec.rb +493 -0
  174. data/spec/packaging/archive_spec.rb +527 -0
  175. data/spec/packaging/artifact_namespace_spec.rb +654 -0
  176. data/spec/packaging/artifact_spec.rb +795 -0
  177. data/spec/packaging/packaging_helper.rb +63 -0
  178. data/spec/packaging/packaging_spec.rb +684 -0
  179. data/spec/sandbox.rb +142 -0
  180. data/spec/scala/bdd_spec.rb +119 -0
  181. data/spec/scala/compiler_spec.rb +284 -0
  182. data/spec/scala/scala.rb +38 -0
  183. data/spec/scala/tests_spec.rb +261 -0
  184. data/spec/spec_helpers.rb +340 -0
  185. data/spec/version_requirement_spec.rb +129 -0
  186. metadata +383 -0
@@ -0,0 +1,93 @@
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 under
14
+ # the License.
15
+
16
+
17
+ require 'buildr/java'
18
+ require 'buildr/java/ant'
19
+
20
+
21
+ module Buildr
22
+
23
+ # Provides XMLBeans schema compiler. Require explicitly using <code>require "buildr/xmlbeans"</code>.
24
+ #
25
+ # require 'buildr/xmlbeans'
26
+ # define 'some_proj' do
27
+ # compile_xml_beans _(:source, :main, :xsd) # the directory with *.xsd
28
+ # end
29
+ module XMLBeans
30
+
31
+ # You can use ArtifactNamespace to customize the versions of
32
+ # <code>:xmlbeans</code> or <code>:stax</code> used by this module:
33
+ #
34
+ # require 'buildr/xmlbeans'
35
+ # Buildr::XMLBeans::REQUIRES.xmlbeans = '2.2.0'
36
+ REQUIRES = ArtifactNamespace.for(self) do |ns|
37
+ ns.xmlbeans! 'org.apache.xmlbeans:xmlbeans:jar:2.3.0', '>2'
38
+ ns.stax_api! 'stax:stax-api:jar:>=1.0.1'
39
+ end
40
+
41
+ class << self
42
+
43
+ def compile(*args)
44
+ options = Hash === args.last ? args.pop : {}
45
+ options[:verbose] ||= Rake.application.options.trace || false
46
+ rake_check_options options, :verbose, :noop, :javasource, :jar, :compile, :output, :xsb
47
+ puts "Running XMLBeans schema compiler" if verbose
48
+ Buildr.ant "xmlbeans" do |ant|
49
+ ant.taskdef :name=>"xmlbeans", :classname=>"org.apache.xmlbeans.impl.tool.XMLBean",
50
+ :classpath=>requires.join(File::PATH_SEPARATOR)
51
+ ant.xmlbeans :srconly=>"true", :srcgendir=>options[:output].to_s, :classgendir=>options[:output].to_s,
52
+ :javasource=>options[:javasource] do
53
+ args.flatten.each { |file| ant.fileset File.directory?(file) ? { :dir=>file } : { :file=>file } }
54
+ end
55
+ end
56
+ # Touch paths to let other tasks know there's an update.
57
+ touch options[:output].to_s, :verbose=>false
58
+ end
59
+
60
+ def requires()
61
+ @requires ||= REQUIRES.artifacts.each(&:invoke).map(&:to_s)
62
+ end
63
+ end
64
+
65
+ def compile_xml_beans(*args)
66
+ # Run whenever XSD file changes, but typically we're given an directory of XSD files, or even file patterns
67
+ # (the last FileList is there to deal with things like *.xsdconfig).
68
+ files = args.flatten.map { |file| File.directory?(file) ? FileList["#{file}/*.xsd"] : FileList[file] }.flatten
69
+ # Generate sources and add them to the compile task.
70
+ generated = file(path_to(:target, :generated, :xmlbeans)=>files) do |task|
71
+ XMLBeans.compile args.flatten, :output=>task.name,
72
+ :javasource=>compile.options.source, :xsb=>compile.target
73
+ end
74
+ compile.using(:javac).from(generated).with(*XMLBeans.requires)
75
+ # Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file
76
+ # into the target directory, or the rest is useless.
77
+ compile do |task|
78
+ verbose(false) do
79
+ base = generated.to_s
80
+ FileList["#{base}/**/*.{class,xsb,xsd}"].each do |file|
81
+ target = File.join(compile.target.to_s, Util.relative_path(file, base))
82
+ mkpath File.dirname(target) ; cp file, target
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ class Project
91
+ include XMLBeans
92
+ end
93
+ end
data/bin/buildr ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # Licensed to the Apache Software Foundation (ASF) under one or more
3
+ # contributor license agreements. See the NOTICE file distributed with this
4
+ # work for additional information regarding copyright ownership. The ASF
5
+ # licenses this file to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ # License for the specific language governing permissions and limitations under
15
+ # the License.
16
+
17
+ require 'rubygems'
18
+ require 'buildr'
19
+ Buildr.application.run
data/buildr.buildfile ADDED
@@ -0,0 +1,58 @@
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 under
14
+ # the License.
15
+
16
+ $LOADED_FEATURES << 'jruby' unless RUBY_PLATFORM =~ /java/ # Pretend to have JRuby, keeps Nailgun happy.
17
+ require 'buildr/jetty'
18
+ require 'buildr/nailgun'
19
+ require 'buildr/scala'
20
+ repositories.remote << 'http://repo1.maven.org/maven2'
21
+ repositories.remote << 'http://scala-tools.org/repo-releases/'
22
+
23
+
24
+ define 'buildr' do
25
+ compile.using :source=>'1.4', :target=>'1.4', :debug=>false
26
+
27
+ define 'java' do
28
+ compile.using(:javac).from(FileList['lib/buildr/java/**/*.java']).into('lib/buildr/java')
29
+ end
30
+
31
+ define 'scala' do
32
+ compile.using(:scalac).from(FileList['lib/buildr/scala/**/*.scala']).into('lib/buildr/scala')
33
+ end
34
+
35
+ desc 'Buildr extra packages (Antlr, Cobertura, Hibernate, Javacc, JDepend, Jetty, OpenJPA, XmlBeans)'
36
+ define 'extra', :version=>'1.0' do
37
+ compile.using(:javac).from(FileList['addon/buildr/**/*.java']).into('addon/buildr').with(Buildr::Jetty::REQUIRES, Buildr::Nailgun::ARTIFACT_SPEC)
38
+ # Legals included in source code and show in RDoc.
39
+ legal = 'LICENSE', 'NOTICE'
40
+ package(:gem).include(legal).path('lib').include('addon/buildr')
41
+ package(:gem).spec do |spec|
42
+ spec.author = 'Apache Buildr'
43
+ spec.email = 'users@buildr.apache.org'
44
+ spec.homepage = "http://buildr.apache.org"
45
+ spec.rubyforge_project = 'buildr'
46
+ spec.extra_rdoc_files = legal
47
+ spec.rdoc_options << '--webcvs' << 'http://svn.apache.org/repos/asf/buildr/trunk/'
48
+ spec.add_dependency 'buildr', '~> 1.3'
49
+ end
50
+
51
+ install do
52
+ addon package(:gem)
53
+ end
54
+
55
+ upload do
56
+ end
57
+ end
58
+ end
data/buildr.gemspec ADDED
@@ -0,0 +1,65 @@
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 under
14
+ # the License.
15
+
16
+
17
+ Gem::Specification.new do |spec|
18
+ spec.name = 'buildr'
19
+ spec.version = '1.3.5'
20
+ spec.author = 'Apache Buildr'
21
+ spec.email = "users@buildr.apache.org"
22
+ spec.homepage = "http://buildr.apache.org/"
23
+ spec.summary = "A build system that doesn't suck"
24
+ spec.description = <<-TEXT
25
+ Apache Buildr is a build system for Java-based applications, including support
26
+ for Scala, Groovy and a growing number of JVM languages and tools. We wanted
27
+ something that's simple and intuitive to use, so we only need to tell it what
28
+ to do, and it takes care of the rest. But also something we can easily extend
29
+ for those one-off tasks, with a language that's a joy to use.
30
+ TEXT
31
+ spec.rubyforge_project = 'buildr'
32
+
33
+ # Rakefile needs to create spec for both platforms (ruby and java), using the
34
+ # $platform global variable. In all other cases, we figure it out from RUBY_PLATFORM.
35
+ spec.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
36
+
37
+ spec.files = Dir['{addon,bin,doc,etc,lib,rakelib,spec}/**/*', '*.{gemspec,buildfile}'] +
38
+ ['LICENSE', 'NOTICE', 'CHANGELOG', 'README.rdoc', 'Rakefile', '_buildr', '_jbuildr']
39
+ spec.require_paths = 'lib', 'addon'
40
+ spec.bindir = 'bin' # Use these for applications.
41
+ spec.executable = 'buildr'
42
+
43
+ spec.has_rdoc = true
44
+ spec.extra_rdoc_files = 'README.rdoc', 'CHANGELOG', 'LICENSE', 'NOTICE'
45
+ spec.rdoc_options = '--title', 'Buildr', '--main', 'README.rdoc',
46
+ '--webcvs', 'http://svn.apache.org/repos/asf/buildr/trunk/'
47
+ spec.post_install_message = "To get started run buildr --help"
48
+
49
+ # Tested against these dependencies.
50
+ spec.add_dependency 'rake', '0.8.7'
51
+ spec.add_dependency 'builder', '2.1.2'
52
+ spec.add_dependency 'net-ssh', '2.0.15'
53
+ spec.add_dependency 'net-sftp', '2.0.2'
54
+ spec.add_dependency 'rubyzip', '0.9.1'
55
+ spec.add_dependency 'highline', '1.5.1'
56
+ spec.add_dependency 'rubyforge', '1.0.5'
57
+ spec.add_dependency 'hoe', '2.3.3'
58
+ spec.add_dependency 'rjb', '1.1.9' if spec.platform.to_s == 'ruby'
59
+ spec.add_dependency 'rjb', '1.1.6' if spec.platform.to_s == 'x86-mswin32'
60
+ spec.add_dependency 'Antwrap', '0.7.0'
61
+ spec.add_dependency 'rspec', '1.2.8'
62
+ spec.add_dependency 'xml-simple', '1.0.12'
63
+ spec.add_dependency 'archive-tar-minitar', '0.5.2'
64
+ spec.add_dependency 'jruby-openssl', '0.5.2' if spec.platform.to_s == 'java'
65
+ end
data/doc/_config.yml ADDED
@@ -0,0 +1 @@
1
+ pygments: true
@@ -0,0 +1,88 @@
1
+ <html>
2
+ <head>
3
+ <meta content='text/html;charset=UTF-8' http-equiv='Content-Type'>
4
+ <title>buildr &mdash; {{ page.title }}</title>
5
+ <style type='text/css'>
6
+ @import 'css/default.css';
7
+ @import 'css/syntax.css';
8
+ </style>
9
+ <style media='print' type='text/css'>
10
+ @import 'css/print.css';
11
+ </style>
12
+ <meta content='Official Buildr documentation from the people in the know' name='subject'>
13
+ <link href='images/favicon.png' rel='shortcut icon'>
14
+ </head>
15
+ <body>
16
+ <div id='wrap'>
17
+ <div id='header'>
18
+ <a href='http://buildr.apache.org/' title="The build system that doesn't suck"><img alt='buildr' src='images/buildr.png'></a>
19
+ <div class='tagline'>The build system that doesn't suck</div>
20
+ </div>
21
+ <div id='pages'>
22
+ <ol class='toc'>
23
+ <li>Start Here
24
+ <ol class="toc">
25
+ <li><a href='index.html'>Welcome</a></li>
26
+ <li><a href='quick_start.html'>Quick Start</a></li>
27
+ <li><a href='installing.html'>Installing & Running</a></li>
28
+ <li><a href='http://cwiki.apache.org/confluence/display/BUILDR/Index'>Community Wiki</a></li>
29
+ </ol>
30
+ </li>
31
+ <li>Using Buildr
32
+ <ol class="toc">
33
+ <li><a href='buildr.pdf'>This Guide (PDF)</a></li>
34
+ <li><a href='projects.html'>Projects</a></li>
35
+ <li><a href='building.html'>Building</a></li>
36
+ <li><a href='artifacts.html'>Artifacts</a></li>
37
+ <li><a href='packaging.html'>Packaging</a></li>
38
+ <li><a href='testing.html'>Testing</a></li>
39
+ <li><a href='settings_profiles.html'>Settings/Profiles</a></li>
40
+ <li><a href='languages.html'>Languages</a></li>
41
+ <li><a href='more_stuff.html'>More Stuff</a></li>
42
+ <li><a href='extending.html'>Extending Buildr</a></li>
43
+ <li><a href='http://cwiki.apache.org/confluence/display/BUILDR/Buildr+HowTos'>How-Tos</a></li>
44
+ </ol>
45
+ </li>
46
+ <li>Reference
47
+ <ol class="toc">
48
+ <li><a href='rdoc'>API</a></li>
49
+ <li><a href='http://docs.rubyrake.org'>Rake</a></li>
50
+ <li><a href='http://antwrap.rubyforge.org'>Antwrap</a></li>
51
+ <li><a href='http://cwiki.apache.org/confluence/display/BUILDR/Common+Problems+and+Solutions'>Troubleshooting</a></li>
52
+ </ol>
53
+ </li>
54
+ <li>Get Involved
55
+ <ol class="toc">
56
+ <li><a href='download.html'>Download</a></li>
57
+ <li><a href='mailing_lists.html'>Mailing Lists</a></li>
58
+ <li><a href='http://issues.apache.org/jira/browse/Buildr'>Issues/Bugs</a></li>
59
+ <li><a href='contributing.html'>Contributing</a></li>
60
+ <li><a href='specs.html'>Specs</a></li>
61
+ <li><a href='coverage/index.html'>Coverage</a></li>
62
+ </ol>
63
+ </li>
64
+ <li>
65
+ <form action='http://www.google.com/cse' id='searchbox_003673095760649043902:ogcgrzu0l2y'>
66
+ <input name='cx' type='hidden' value='003673095760649043902:ogcgrzu0l2y'>
67
+ <input name='cof' type='hidden' value='FORID:0'>
68
+ <input name='q' size='20' type='text'>
69
+ <input name='sa' type='submit' value='Search'>
70
+ <img alt='Google Custom Search' src='http://www.google.com/coop/images/google_custom_search_smnar.gif'>
71
+ </form>
72
+ </li>
73
+ <li>The Buildr Book
74
+ <p><a href='http://www.amazon.com/Buildr/dp/1442160942/'><img src='images/1442160941-frontcover.jpg' style='width:120px'></a></p>
75
+ <p>Based on the Buildr documentation, available from <a href='http://www.amazon.com/Buildr/dp/1442160942/'>Amazon</a> and
76
+ <a href='http://www.createspace.com/3382199'>CreateSpace</a></p>
77
+ </li>
78
+ </ol>
79
+ </div>
80
+ <div id='content'>
81
+ <h1 id='{{ page.title | downcase | replace(' ', '_') }}'>{{ page.title }}</h1>
82
+ {{ content | toc }}
83
+ {{ content }}
84
+ </div>
85
+ <div id='footer'>Copyright &copy; 2007-2009 The Apache Software Foundation</div>
86
+ </div>
87
+ </body>
88
+ </html>
@@ -0,0 +1,22 @@
1
+ <html>
2
+ <head>
3
+ <meta content='text/html;charset=UTF-8' http-equiv='Content-Type' />
4
+ <title>buildr</title>
5
+ <style type='text/css'>
6
+ @import 'css/default.css';
7
+ @import 'css/syntax.css';
8
+ </style>
9
+ <style media='print' type='text/css'>
10
+ @import 'css/print.css';
11
+ </style>
12
+ <meta content='Official Buildr documentation from the people in the know' name='subject' />
13
+ <link href='images/favicon.png' rel='shortcut icon' />
14
+ </head>
15
+ <body>
16
+ <div id='wrap'>
17
+ <div id='content'>
18
+ {{ content }}
19
+ </div>
20
+ </div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,211 @@
1
+ ---
2
+ layout: default
3
+ title: Artifacts
4
+ ---
5
+
6
+
7
+ In Buildr, almost everything is a file or a file task. You compile source files that come from the file system using dependencies found on the file system, generating even more files. But how do you get these dependencies to start with, and how do you share them with others?
8
+
9
+ Artifacts. We designed Buildr to work as a drop-in replacement for Maven 2.0, and share artifacts through the same local and remote repositories. Artifact tasks know how to download a file from one of the remote repositories, and install it in the local repository, where Buildr can find it. Packages know how to create files and upload them to remote repositories.
10
+
11
+ We'll get into all of that in a second, but first, let's introduce the artifact specification. It's a simple string that takes one of two forms:
12
+
13
+ {% highlight text %}
14
+ group:id:type:version
15
+ group:id:type:classifier:version
16
+ {% endhighlight %}
17
+
18
+ For example, @'org.apache.axis2:axis2:jar:1.2'@ refers to an artifact with group identifier org.apache.axis2, artifact identifier axis2, a JAR file with version 1.2. Classifiers are typically used to distinguish between similar file types, for example, a source distribution and a binary distribution that otherwise have the same identifier and are both ZIP files.
19
+
20
+
21
+ h2(#specifying). Specifying Artifacts
22
+
23
+ If your Buildfile spells out @'org.apache.axis2:axis2:jar:1.2'@ more than once, you're doing something wrong. Repeating the same string over and over will make your code harder to maintain. You'll know that when you upgrade to a new version in one place, forget to do it in another, and end up with a mismatch.
24
+
25
+ You can use Ruby's syntax to do simple string substitution, for example:
26
+
27
+ {% highlight ruby %}
28
+ AXIS_VERSION = '1.2'
29
+
30
+ compile.with "org.apache.axis2:axis2:jar:#{AXIS_VERSION}"
31
+ {% endhighlight %}
32
+
33
+ Better yet, you can define all your artifacts at the top of the Buildfile and use constants to reference them in your project definition. For example:
34
+
35
+ {% highlight ruby %}
36
+ AXIS2 = 'org.apache.axis2:axis2:jar:1.2'
37
+
38
+ compile.with AXIS2
39
+ {% endhighlight %}
40
+
41
+ Note that we're not using a separate constant for the version number. In our experience, it's unnecessary. The version number intentionally appears at the end of the string, where it stands out easily.
42
+
43
+ If you have a set of artifacts that belong to the same group and version, and that's quite common, you can use the @group@ shortcut:
44
+
45
+ {% highlight ruby %}
46
+ AXIOM = group('axiom-api', 'axiom-impl', 'axiom-dom',
47
+ :under=>'org.apache.ws.commons.axiom', :version=>'1.2.4')
48
+ {% endhighlight %}
49
+
50
+ p(note). Buildr projects also define a @group@ attribute which can lead to some confusion. If you want to define an artifact group within a project definition, you should use the explicit qualifier @Buildr::group@.
51
+
52
+ If you have several artifacts you always use together, consider placing them in an array. Methods that accept lists of artifacts also accept arrays. For example:
53
+
54
+ {% highlight ruby %}
55
+ OPENJPA = ['org.apache.openjpa:openjpa-all:jar:0.9.7',
56
+ 'net.sourceforge.serp:serp:jar:1.12.0']
57
+ AXIS_OF_WS = [AXIS2, AXIOM]
58
+
59
+ compile.with OPENJPA, AXIS_OF_WS
60
+ {% endhighlight %}
61
+
62
+ Another way to group related artifacts together and access them individually is using the @struct@ shortcut. For example:
63
+
64
+ {% highlight ruby %}
65
+ JAVAX = struct(
66
+ :activation =>'javax.activation:activation:jar:1.1',
67
+ :persistence =>'javax.persistence:persistence-api:jar:1.0',
68
+ :stream =>'stax:stax-api:jar:1.0.1',
69
+ )
70
+
71
+ compile.with JAVAX.persistence, OPENJPA
72
+ {% endhighlight %}
73
+
74
+ In our experience, using constants in this manner makes your Buildfile much easier to write and maintain.
75
+
76
+ And, of course, you can always place your artifact specifications in a separate file and require it into your Buildfile. For example, if you're working on several different projects that all share the same artifacts:
77
+
78
+ {% highlight ruby %}
79
+ require '../shared/artifacts'
80
+ {% endhighlight %}
81
+
82
+ When you use @require@, Ruby always looks for a filename with the @.rb@ extension, so in this case it expects to find @artifacts.rb@ in the @shared@ directory.
83
+
84
+ One last thing. You can also treat artifact specifications as hashes. For example:
85
+
86
+ {% highlight ruby %}
87
+ AXIS = { :group=>'org.apache.axis2', :id=>'axis2', :version=>'1.2' }
88
+ compile.with AXIS
89
+ puts compile.dependencies.first.to_hash
90
+ => { :group=>'org.apache.axis2', :id=>'axis2',
91
+ :version=>'1.2', :type=>:jar }
92
+ {% endhighlight %}
93
+
94
+
95
+ h2(#repositories). Specifying Repositories
96
+
97
+ Buildr can download artifacts for you, but only if you tell it where to find them. You need to specify at least one remote repository, from which to download these artifacts.
98
+
99
+ When you call @repositories.remote@, you get an array of URLs for the various remote repositories. Initially, it's an empty array, to which you can add new repositories. For example:
100
+
101
+ {% highlight ruby %}
102
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
103
+ {% endhighlight %}
104
+
105
+ If you need to use a proxy server to access remote repositories, you can set the environment variable @HTTP_PROXY@ to the proxy server URL (use @HTTPS_PROXY@ for proxying HTTPS connections). You can also work without a proxy for certain hosts by specifying the @NO_PROXY@ environment variable. For example:
106
+
107
+ {% highlight sh %}
108
+ $ export HTTP_PROXY = 'http://myproxy:8080'
109
+ $ export NO_PROXY = '*.mycompany.com,localhost,special:800'
110
+ {% endhighlight %}
111
+
112
+ Alternatively you can use the Buildr options @proxy.http@ and @proxy.exclude@:
113
+
114
+ {% highlight ruby %}
115
+ options.proxy.http = 'http://myproxy:8080'
116
+ options.proxy.exclude << '*.mycompany.com'
117
+ options.proxy.exclude << 'localhost'
118
+ {% endhighlight %}
119
+
120
+ All the artifacts download into the local repository. Since all your projects share the same local repository, you only need to download each artifact once. Buildr was designed to be used alongside Maven 2.0, for example, when migrating projects from Maven 2.0 over to Buildr. By default it will share the same local repository, expecting the repository to be the @.m2/repository@ directory inside your home directory.
121
+
122
+ You can choose to relocate the local repository by giving it a different path, for example:
123
+
124
+ {% highlight ruby %}
125
+ repositories.local = '/usr/local/maven/repository'
126
+ {% endhighlight %}
127
+
128
+ That's one change you don't want to commit into the Buildfile, so the best place to do it is in your home directory's @buildr.rb@ file.
129
+
130
+ Buildr downloads artifacts when it needs to use them, for example, to compile a project. You don't need to download artifacts directly. Except when you do, for example, if you want to download all the latest artifacts and then go off-line. It's as simple as:
131
+
132
+ {% highlight sh %}
133
+ $ buildr artifacts
134
+ {% endhighlight %}
135
+
136
+
137
+ h2(#downloading). Downloading Artifacts
138
+
139
+ Within your buildfile you can download artifacts directly by invoking them, for example:
140
+
141
+ {% highlight ruby %}
142
+ artifact('org.apache.openjpa:openjpa-all:jar:0.9.7').invoke
143
+ artifacts(OPENJPA).each(&:invoke)
144
+ {% endhighlight %}
145
+
146
+ When you let Buildr download artifacts for you, or by invoking the artifact task yourself, it scans through the remote repositories assuming each repository follows the Maven 2 structure. Starting from the root repository URL, it will look for each artifact using the path @group/id/version/id-version.type@ (or ...@/id-version-classifier.type@). The group identifier becomes a path by turning periods (@.@) into slashes (@/@). So to find @org.apache.axis2:axis2:jar:1.2@, we're going to look for @org/apache/axis2/axis2/1.2/axis2-1.2.jar@.
147
+
148
+ You'll find a lot of open source Java libraries in public repositories that support this structure (for example, the "Ibiblio Maven":http://www.ibiblio.org/maven2/ repository). And, of course, every remote repository you setup for your projects.
149
+
150
+ But there are exceptions to the rule. Say we want to download the Dojo widget library and use it in our project. It's available from the Dojo Web site, but that site doesn't follow the Maven repository conventions, so our feeble attempt to use existing remote repositories will fail.
151
+
152
+ We can still treat Dojo as an artifact, by telling Buildr where to download it from:
153
+
154
+ {% highlight ruby %}
155
+ DOJO = '0.2.2'
156
+
157
+ url = "http://download.dojotoolkit.org/release-#{DOJO}/dojo-#{DOJO}-widget.zip"
158
+ download(artifact("dojo:dojo:zip:widget:#{DOJO}")=>url)
159
+ {% endhighlight %}
160
+
161
+ Explaining how it works is tricky, skip if you don't care for the details. On the other hand, it will give you a better understanding of Buildr/Rake, so if not now, come back and read it later.
162
+
163
+ We use the @artifact@ method to create an @Artifact@ task that references the Dojo widget in our local repository. The @Artifact@ task is a file task with some additional behavior added by Buildr. When you call @compile.with@, that's exactly what it does internally, turning each of your artifact specifications into an @Artifact@ task.
164
+
165
+ But the @Artifact@ task doesn't know how to download the Dojo widget, only how to handle conventional repositories. So we're going to create a download task as well. We use the @download@ method to create a file task that downloads the file from a remote URL. (Of course, it will only download the file if it doesn't already exist.)
166
+
167
+ But which task gets used when? We could have defined these tasks separately and used some glue code to make one use the other. Instead, we call @download@ with the results of @artifact@. Essentially, we're telling @download@ to use the same file path as @artifact@. So now we have two file tasks that point to the very same file. We wired them together.
168
+
169
+ You can't have more than one task pointing to the same file. Rake's rule of the road. What Rake does is merge the tasks together, creating a single file task for @artifact@, and then enhancing it with another action from @download@. One task, two actions. Statistically, we've doubled the odds that at least one of these actions will manage to download the Dojo widget and install it in the local repository.
170
+
171
+ Since we ordered the calls to @artifact@ first and @download@ second, we know the actions will execute in that order. But @artifact@ is slightly devilish: when its action runs, it adds another action to the end of the list. So the @artifact@ action runs first, adds an action at the end, the @download@ action runs second, and downloads the Dojo widget for us. The second @artifact@ action runs last, but checks that the file already exist and doesn't try to download it again.
172
+
173
+ Magic.
174
+
175
+
176
+ h2(#install_upload). Install and Upload
177
+
178
+ Generally you use artifacts that download from remote repositories into the local repository, or artifacts packaged by the project itself (see "Packaging":packaging.html), which are then installed into the local repository and uploaded to the release server.
179
+
180
+ Some artifacts do not fall into either category. In this example we're going to download a ZIP file, extract a JAR file from it, and use that JAR file as an artifact. We would then expect to install this JAR in the local repository and upload it to the release server, where it can be shared with other projects.
181
+
182
+ So let's start by creating a task that downloads the ZIP, and another one to extract it and create the JAR file:
183
+
184
+ {% highlight ruby %}
185
+ app_zip = download('target/app.zip'=>url)
186
+ bean_jar = file('target/app/bean.jar'=>unzip('target/app'=>app_zip))
187
+ {% endhighlight %}
188
+
189
+ When you call @artifact@, it returns an @Artifact@ task that points to the artifact file in the local repository, downloading the file if it doesn't already exist. You can override this behavior by enhancing the task and creating the file yourself (you may also want to create a POM file). Or much simpler, call the @from@ method on the artifact and tell it where to find the source file.
190
+
191
+ So the next step is to specify the artifact and tell it to use the extracted JAR file:
192
+
193
+ {% highlight ruby %}
194
+ bean = artifact('example.com:beans:jar:1.0').from(bean_jar)
195
+ {% endhighlight %}
196
+
197
+ The artifact still points to the local repository, but when we invoke the task it copies the source file over to the local repository, instead of attempting a download.
198
+
199
+ Use the @install@ method if you want the artifact and its POM installed in the local repository when you run the @install@ task. Likewise, use the @upload@ method if you want the artifact uploaded to the release server when you run the @upload@ task. You do not need to do this on artifacts downloaded from a remote server, or created with the @package@ method, the later are automatically added to the list of installed/uploaded artifacts.
200
+
201
+ Our example ends by including the artifact in the @install@ and @upload@ tasks:
202
+
203
+ {% highlight ruby %}
204
+ install bean
205
+ upload bean
206
+ {% endhighlight %}
207
+
208
+ p(tip). Calling the @install@ (and likewise @upload@) method on an artifact run @buildr install@. If you need to download and install an artifact, invoke the task directly with @install(<artifact>).invoke@.
209
+
210
+
211
+ Next we're going to "package some artifacts":packaging.html.