buildr 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +76 -0
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +20 -37
- data/_buildr +3 -12
- data/{doc/print.toc.yaml → _jbuildr} +14 -14
- data/addon/buildr/cobertura.rb +5 -219
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -221
- data/addon/buildr/nailgun.rb +93 -689
- data/bin/buildr +0 -9
- data/buildr.buildfile +4 -4
- data/buildr.gemspec +27 -21
- data/doc/_layouts/default.html +82 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
- data/doc/{pages/building.textile → building.textile} +89 -47
- data/doc/{pages/contributing.textile → contributing.textile} +53 -45
- data/doc/css/default.css +6 -5
- data/doc/css/print.css +17 -24
- data/doc/css/syntax.css +7 -36
- data/doc/download.textile +78 -0
- data/doc/{pages/extending.textile → extending.textile} +45 -24
- data/doc/{pages/getting_started.textile → getting_started.textile} +146 -88
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/note.png +0 -0
- data/doc/index.textile +47 -0
- data/doc/{pages/languages.textile → languages.textile} +108 -54
- data/doc/mailing_lists.textile +25 -0
- data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
- data/doc/{pages/packaging.textile → packaging.textile} +181 -96
- data/doc/preface.textile +28 -0
- data/doc/{pages/projects.textile → projects.textile} +55 -40
- data/doc/scripts/buildr-git.rb +364 -264
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +2 -2
- data/doc/scripts/install-linux.sh +6 -6
- data/doc/scripts/install-osx.sh +2 -2
- data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
- data/doc/{pages/testing.textile → testing.textile} +77 -41
- data/lib/buildr.rb +5 -5
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +321 -151
- data/lib/buildr/core/build.rb +298 -167
- data/lib/buildr/core/checks.rb +4 -132
- data/lib/buildr/core/common.rb +1 -5
- data/lib/buildr/core/compile.rb +3 -9
- data/lib/buildr/core/environment.rb +12 -3
- data/lib/buildr/core/filter.rb +20 -18
- data/lib/buildr/core/generate.rb +36 -36
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -34
- data/lib/buildr/core/test.rb +12 -6
- data/lib/buildr/core/transports.rb +13 -11
- data/lib/buildr/core/util.rb +14 -23
- data/lib/buildr/groovy/bdd.rb +3 -2
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +31 -21
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +6 -4
- data/lib/buildr/java/ant.rb +3 -1
- data/lib/buildr/java/bdd.rb +9 -7
- data/lib/buildr/java/cobertura.rb +243 -0
- data/lib/buildr/java/compiler.rb +5 -4
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/packaging.rb +11 -8
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +5 -7
- data/lib/buildr/java/tests.rb +17 -11
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +48 -29
- data/lib/buildr/packaging/artifact_namespace.rb +6 -6
- data/lib/buildr/packaging/gems.rb +4 -4
- data/lib/buildr/packaging/package.rb +3 -2
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala.rb +5 -0
- data/lib/buildr/scala/bdd.rb +100 -0
- data/lib/buildr/scala/compiler.rb +45 -4
- data/lib/buildr/scala/tests.rb +12 -59
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +58 -68
- data/rakelib/jekylltask.rb +110 -0
- data/rakelib/package.rake +35 -37
- data/rakelib/release.rake +119 -35
- data/rakelib/rspec.rake +29 -39
- data/rakelib/setup.rake +21 -59
- data/rakelib/stage.rake +184 -26
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +32 -25
- data/spec/core/build_spec.rb +336 -126
- data/spec/core/checks_spec.rb +292 -310
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +3 -3
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +8 -1
- data/spec/core/transport_spec.rb +40 -3
- data/spec/core/util_spec.rb +67 -0
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +12 -3
- data/spec/{addon → java}/cobertura_spec.rb +6 -6
- data/spec/{addon → java}/emma_spec.rb +5 -6
- data/spec/java/java_spec.rb +12 -2
- data/spec/java/packaging_spec.rb +31 -2
- data/spec/{addon → java}/test_coverage_spec.rb +3 -3
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +11 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
- data/spec/packaging/artifact_spec.rb +44 -3
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +17 -14
- data/spec/scala/bdd_spec.rb +150 -0
- data/spec/scala/compiler_spec.rb +27 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +78 -33
- data/spec/spec_helpers.rb +29 -5
- data/spec/version_requirement_spec.rb +6 -0
- metadata +175 -171
- data/DISCLAIMER +0 -7
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/pages/download.textile +0 -51
- data/doc/pages/index.textile +0 -42
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/git-svn-authors +0 -16
- data/lib/buildr/core/application_cli.rb +0 -139
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/rubyforge.rake +0 -53
- data/rakelib/scm.rake +0 -49
data/bin/buildr
CHANGED
@@ -14,15 +14,6 @@
|
|
14
14
|
# License for the specific language governing permissions and limitations under
|
15
15
|
# the License.
|
16
16
|
|
17
|
-
start = Time.now
|
18
17
|
require 'rubygems'
|
19
18
|
require 'buildr'
|
20
19
|
Buildr.application.run
|
21
|
-
if verbose
|
22
|
-
elapsed = Time.now - start
|
23
|
-
real = []
|
24
|
-
real << ("%ih" % (elapsed / 3600)) if elapsed >= 3600
|
25
|
-
real << ("%im" % ((elapsed / 60) % 60)) if elapsed >= 60
|
26
|
-
real << ("%.3fs" % (elapsed % 60))
|
27
|
-
puts $terminal.color("Completed in #{real.join}", :green)
|
28
|
-
end
|
data/buildr.buildfile
CHANGED
@@ -31,15 +31,15 @@ define 'buildr' do
|
|
31
31
|
define 'extra', :version=>'1.0' do
|
32
32
|
compile.using(:javac).from(FileList['addon/buildr/**/*.java']).into('addon/buildr').with(Buildr::Jetty::REQUIRES, Buildr::Nailgun::ARTIFACT_SPEC)
|
33
33
|
# Legals included in source code and show in RDoc.
|
34
|
-
legal = 'LICENSE', '
|
34
|
+
legal = 'LICENSE', 'NOTICE'
|
35
35
|
package(:gem).include(legal).path('lib').include('addon/buildr')
|
36
36
|
package(:gem).spec do |spec|
|
37
37
|
spec.author = 'Apache Buildr'
|
38
|
-
spec.email = 'buildr
|
39
|
-
spec.homepage = "http://
|
38
|
+
spec.email = 'users@buildr.apache.org'
|
39
|
+
spec.homepage = "http://buildr.apache.org"
|
40
40
|
spec.rubyforge_project = 'buildr'
|
41
41
|
spec.extra_rdoc_files = legal
|
42
|
-
spec.rdoc_options << '--webcvs' << 'http://svn.apache.org/repos/asf/
|
42
|
+
spec.rdoc_options << '--webcvs' << 'http://svn.apache.org/repos/asf/buildr/trunk/'
|
43
43
|
spec.add_dependency 'buildr', '~> 1.3'
|
44
44
|
end
|
45
45
|
|
data/buildr.gemspec
CHANGED
@@ -16,43 +16,49 @@
|
|
16
16
|
|
17
17
|
Gem::Specification.new do |spec|
|
18
18
|
spec.name = 'buildr'
|
19
|
-
spec.version = '1.3.
|
19
|
+
spec.version = '1.3.4'
|
20
20
|
spec.author = 'Apache Buildr'
|
21
|
-
spec.email = "buildr
|
22
|
-
spec.homepage = "http://
|
23
|
-
spec.summary =
|
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
|
24
31
|
spec.rubyforge_project = 'buildr'
|
25
32
|
|
26
33
|
# Rakefile needs to create spec for both platforms (ruby and java), using the
|
27
34
|
# $platform global variable. In all other cases, we figure it out from RUBY_PLATFORM.
|
28
35
|
spec.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
|
29
36
|
|
30
|
-
spec.files = Dir['lib
|
31
|
-
|
32
|
-
|
33
|
-
spec.require_paths = ['lib', 'addon']
|
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'
|
34
40
|
spec.bindir = 'bin' # Use these for applications.
|
35
41
|
spec.executable = 'buildr'
|
36
42
|
|
37
43
|
spec.has_rdoc = true
|
38
|
-
spec.extra_rdoc_files =
|
39
|
-
spec.rdoc_options
|
40
|
-
|
41
|
-
|
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"
|
42
48
|
|
43
49
|
# Tested against these dependencies.
|
44
|
-
spec.add_dependency 'rake', '0.8.
|
50
|
+
spec.add_dependency 'rake', '0.8.4'
|
45
51
|
spec.add_dependency 'builder', '2.1.2'
|
46
|
-
spec.add_dependency 'net-ssh', '2.0.
|
47
|
-
spec.add_dependency 'net-sftp', '2.0.
|
52
|
+
spec.add_dependency 'net-ssh', '2.0.11'
|
53
|
+
spec.add_dependency 'net-sftp', '2.0.2'
|
48
54
|
spec.add_dependency 'rubyzip', '0.9.1'
|
49
|
-
spec.add_dependency 'highline', '1.
|
50
|
-
spec.add_dependency 'rubyforge', '1.0.
|
51
|
-
spec.add_dependency 'hoe', '1.
|
55
|
+
spec.add_dependency 'highline', '1.5.0'
|
56
|
+
spec.add_dependency 'rubyforge', '1.0.3'
|
57
|
+
spec.add_dependency 'hoe', '1.11.0'
|
52
58
|
spec.add_dependency 'rjb', '1.1.6' if spec.platform.to_s == 'ruby'
|
53
59
|
spec.add_dependency 'Antwrap', '0.7.0'
|
54
|
-
spec.add_dependency 'rspec', '1.
|
55
|
-
spec.add_dependency 'xml-simple', '1.0.
|
60
|
+
spec.add_dependency 'rspec', '1.2.2'
|
61
|
+
spec.add_dependency 'xml-simple', '1.0.12'
|
56
62
|
spec.add_dependency 'archive-tar-minitar', '0.5.2'
|
57
|
-
spec.add_dependency 'jruby-openssl', '0.
|
63
|
+
spec.add_dependency 'jruby-openssl', '0.3' if spec.platform.to_s == 'java'
|
58
64
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta content='text/html;charset=UTF-8' http-equiv='Content-Type' />
|
4
|
+
<title>buildr — {{ 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/'>
|
19
|
+
<img alt='buildr' src='images/buildr.png' />
|
20
|
+
</a>
|
21
|
+
<div class='tagline'></div>
|
22
|
+
</div>
|
23
|
+
<div id='pages'>
|
24
|
+
<ol class='toc'>
|
25
|
+
<li>Start Here
|
26
|
+
<ol class="toc">
|
27
|
+
<li><a href='index.html'>Welcome</a></li>
|
28
|
+
<li><a href='download.html'>Download</a></li>
|
29
|
+
<li><a href='buildr.pdf'>User Guide (PDF)</a></li>
|
30
|
+
<li><a href='http://cwiki.apache.org/confluence/display/BUILDR/Index'>Community Wiki</a></li>
|
31
|
+
</ol>
|
32
|
+
</li>
|
33
|
+
<li>Using Buildr
|
34
|
+
<ol class="toc">
|
35
|
+
<li><a href='getting_started.html'>Getting Started</a></li>
|
36
|
+
<li><a href='projects.html'>Projects</a></li>
|
37
|
+
<li><a href='building.html'>Building</a></li>
|
38
|
+
<li><a href='artifacts.html'>Artifacts</a></li>
|
39
|
+
<li><a href='packaging.html'>Packaging</a></li>
|
40
|
+
<li><a href='testing.html'>Testing</a></li>
|
41
|
+
<li><a href='settings_profiles.html'>Settings/Profiles</a></li>
|
42
|
+
<li><a href='languages.html'>Languages</a></li>
|
43
|
+
<li><a href='more_stuff.html'>More Stuff</a></li>
|
44
|
+
<li><a href='extending.html'>Extending Buildr</a></li>
|
45
|
+
<li><a href='http://cwiki.apache.org/confluence/display/BUILDR/Buildr+HowTos'>How-Tos</a></li>
|
46
|
+
</ol>
|
47
|
+
</li>
|
48
|
+
<li>Reference
|
49
|
+
<ol class="toc">
|
50
|
+
<li><a href='rdoc'>API</a></li>
|
51
|
+
<li><a href='http://docs.rubyrake.org'>Rake</a></li>
|
52
|
+
<li><a href='http://antwrap.rubyforge.org'>Antwrap</a></li>
|
53
|
+
<li><a href='http://cwiki.apache.org/confluence/display/BUILDR/Common+Problems+and+Solutions'>Troubleshooting</a></li>
|
54
|
+
</ol>
|
55
|
+
</li>
|
56
|
+
<li>Get Involved
|
57
|
+
<ol class="toc">
|
58
|
+
<li><a href='mailing_lists.html'>Mailing Lists</a></li>
|
59
|
+
<li><a href='http://issues.apache.org/jira/browse/Buildr'>Issues/Bugs</a></li>
|
60
|
+
<li><a href='contributing.html'>Contributing</a></li>
|
61
|
+
<li><a href='specs.html'>Specs</a></li>
|
62
|
+
<li><a href='coverage/index.html'>Coverage</a></li>
|
63
|
+
</ol>
|
64
|
+
</li>
|
65
|
+
</ol>
|
66
|
+
<form action='http://www.google.com/cse' id='searchbox_003673095760649043902:ogcgrzu0l2y'>
|
67
|
+
<input name='cx' type='hidden' value='003673095760649043902:ogcgrzu0l2y' />
|
68
|
+
<input name='cof' type='hidden' value='FORID:0' />
|
69
|
+
<input name='q' size='20' type='text' />
|
70
|
+
<input name='sa' type='submit' value='Search' />
|
71
|
+
<img alt='Google Custom Search' src='http://www.google.com/coop/images/google_custom_search_smnar.gif' />
|
72
|
+
</form>
|
73
|
+
</div>
|
74
|
+
<div id='content'>
|
75
|
+
<h1 id='{{ page.title | downcase | replace(' ', '_') }}'>{{ page.title }}</h1>
|
76
|
+
{{ content | toc }}
|
77
|
+
{{ content }}
|
78
|
+
</div>
|
79
|
+
<div id='footer'>Copyright © 2007-2009 The Apache Software Foundation</div>
|
80
|
+
</div>
|
81
|
+
</body>
|
82
|
+
</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>
|
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Artifacts
|
4
|
+
---
|
5
|
+
|
2
6
|
|
3
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?
|
4
8
|
|
@@ -6,58 +10,69 @@ Artifacts. We designed Buildr to work as a drop-in replacement for Maven 2.0, an
|
|
6
10
|
|
7
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:
|
8
12
|
|
9
|
-
|
13
|
+
<notextile>
|
14
|
+
{% highlight text %}
|
10
15
|
group:id:type:version
|
11
16
|
group:id:type:classifier:version
|
12
|
-
}
|
17
|
+
{% endhighlight %}
|
18
|
+
</notextile>
|
13
19
|
|
14
20
|
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.
|
15
21
|
|
16
22
|
|
17
|
-
h2. Specifying Artifacts
|
23
|
+
h2(#specifying). Specifying Artifacts
|
18
24
|
|
19
25
|
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.
|
20
26
|
|
21
27
|
You can use Ruby's syntax to do simple string substitution, for example:
|
22
28
|
|
23
|
-
|
29
|
+
<notextile>
|
30
|
+
{% highlight ruby %}
|
24
31
|
AXIS_VERSION = '1.2'
|
25
32
|
|
26
33
|
compile.with "org.apache.axis2:axis2:jar:#{AXIS_VERSION}"
|
27
|
-
}
|
34
|
+
{% endhighlight %}
|
35
|
+
</notextile>
|
28
36
|
|
29
37
|
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:
|
30
38
|
|
31
|
-
|
39
|
+
<notextile>
|
40
|
+
{% highlight ruby %}
|
32
41
|
AXIS2 = 'org.apache.axis2:axis2:jar:1.2'
|
33
42
|
|
34
43
|
compile.with AXIS2
|
35
|
-
}
|
44
|
+
{% endhighlight %}
|
45
|
+
</notextile>
|
36
46
|
|
37
47
|
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.
|
38
48
|
|
39
49
|
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:
|
40
50
|
|
41
|
-
|
51
|
+
<notextile>
|
52
|
+
{% highlight ruby %}
|
42
53
|
AXIOM = group('axiom-api', 'axiom-impl', 'axiom-dom',
|
43
54
|
:under=>'org.apache.ws.commons.axiom', :version=>'1.2.4')
|
44
|
-
}
|
55
|
+
{% endhighlight %}
|
56
|
+
</notextile>
|
45
57
|
|
46
58
|
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@.
|
47
59
|
|
48
60
|
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:
|
49
61
|
|
50
|
-
|
62
|
+
<notextile>
|
63
|
+
{% highlight ruby %}
|
51
64
|
OPENJPA = ['org.apache.openjpa:openjpa-all:jar:0.9.7',
|
52
65
|
'net.sourceforge.serp:serp:jar:1.12.0']
|
53
66
|
AXIS_OF_WS = [AXIS2, AXIOM]
|
54
67
|
|
55
68
|
compile.with OPENJPA, AXIS_OF_WS
|
56
|
-
}
|
69
|
+
{% endhighlight %}
|
70
|
+
</notextile>
|
57
71
|
|
58
72
|
Another way to group related artifacts together and access them individually is using the @struct@ shortcut. For example:
|
59
73
|
|
60
|
-
|
74
|
+
<notextile>
|
75
|
+
{% highlight ruby %}
|
61
76
|
JAVAX = struct(
|
62
77
|
:activation =>'javax.activation:activation:jar:1.1',
|
63
78
|
:persistence =>'javax.persistence:persistence-api:jar:1.0',
|
@@ -65,79 +80,96 @@ JAVAX = struct(
|
|
65
80
|
)
|
66
81
|
|
67
82
|
compile.with JAVAX.persistence, OPENJPA
|
68
|
-
}
|
83
|
+
{% endhighlight %}
|
84
|
+
</notextile>
|
69
85
|
|
70
86
|
In our experience, using constants in this manner makes your Buildfile much easier to write and maintain.
|
71
87
|
|
72
88
|
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:
|
73
89
|
|
74
|
-
|
90
|
+
<notextile>
|
91
|
+
{% highlight ruby %}
|
75
92
|
require '../shared/artifacts'
|
76
|
-
}
|
93
|
+
{% endhighlight %}
|
94
|
+
</notextile>
|
77
95
|
|
78
96
|
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.
|
79
97
|
|
80
98
|
One last thing. You can also treat artifact specifications as hashes. For example:
|
81
99
|
|
82
|
-
|
100
|
+
<notextile>
|
101
|
+
{% highlight ruby %}
|
83
102
|
AXIS = { :group=>'org.apache.axis2', :id=>'axis2', :version=>'1.2' }
|
84
103
|
compile.with AXIS
|
85
104
|
puts compile.dependencies.first.to_hash
|
86
105
|
=> { :group=>'org.apache.axis2', :id=>'axis2',
|
87
106
|
:version=>'1.2', :type=>:jar }
|
88
|
-
}
|
107
|
+
{% endhighlight %}
|
108
|
+
</notextile>
|
89
109
|
|
90
110
|
|
91
|
-
h2. Specifying Repositories
|
111
|
+
h2(#repositories). Specifying Repositories
|
92
112
|
|
93
113
|
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.
|
94
114
|
|
95
115
|
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:
|
96
116
|
|
97
|
-
|
117
|
+
<notextile>
|
118
|
+
{% highlight ruby %}
|
98
119
|
repositories.remote << 'http://www.ibiblio.org/maven2/'
|
99
|
-
}
|
120
|
+
{% endhighlight %}
|
121
|
+
</notextile>
|
100
122
|
|
101
|
-
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. You can also work without a proxy for certain hosts by specifying the @NO_PROXY@ environment variable. For example:
|
123
|
+
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:
|
102
124
|
|
103
|
-
|
125
|
+
<notextile>
|
126
|
+
{% highlight sh %}
|
104
127
|
$ export HTTP_PROXY = 'http://myproxy:8080'
|
105
128
|
$ export NO_PROXY = '*.mycompany.com,localhost,special:800'
|
106
|
-
}
|
129
|
+
{% endhighlight %}
|
130
|
+
</notextile>
|
107
131
|
|
108
132
|
Alternatively you can use the Buildr options @proxy.http@ and @proxy.exclude@:
|
109
133
|
|
110
|
-
|
134
|
+
<notextile>
|
135
|
+
{% highlight ruby %}
|
111
136
|
options.proxy.http = 'http://myproxy:8080'
|
112
137
|
options.proxy.exclude << '*.mycompany.com'
|
113
138
|
options.proxy.exclude << 'localhost'
|
114
|
-
}
|
139
|
+
{% endhighlight %}
|
140
|
+
</notextile>
|
115
141
|
|
116
142
|
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.
|
117
143
|
|
118
144
|
You can choose to relocate the local repository by giving it a different path, for example:
|
119
145
|
|
120
|
-
|
146
|
+
<notextile>
|
147
|
+
{% highlight ruby %}
|
121
148
|
repositories.local = '/usr/local/maven/repository'
|
122
|
-
}
|
149
|
+
{% endhighlight %}
|
150
|
+
</notextile>
|
123
151
|
|
124
152
|
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.
|
125
153
|
|
126
154
|
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:
|
127
155
|
|
128
|
-
|
156
|
+
<notextile>
|
157
|
+
{% highlight sh %}
|
129
158
|
$ buildr artifacts
|
130
|
-
}
|
159
|
+
{% endhighlight %}
|
160
|
+
</notextile>
|
131
161
|
|
132
162
|
|
133
|
-
h2. Downloading Artifacts
|
163
|
+
h2(#downloading). Downloading Artifacts
|
134
164
|
|
135
165
|
Within your buildfile you can download artifacts directly by invoking them, for example:
|
136
166
|
|
137
|
-
|
167
|
+
<notextile>
|
168
|
+
{% highlight ruby %}
|
138
169
|
artifact('org.apache.openjpa:openjpa-all:jar:0.9.7').invoke
|
139
170
|
artifacts(OPENJPA).each(&:invoke)
|
140
|
-
}
|
171
|
+
{% endhighlight %}
|
172
|
+
</notextile>
|
141
173
|
|
142
174
|
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@.
|
143
175
|
|
@@ -147,12 +179,14 @@ But there are exceptions to the rule. Say we want to download the Dojo widget l
|
|
147
179
|
|
148
180
|
We can still treat Dojo as an artifact, by telling Buildr where to download it from:
|
149
181
|
|
150
|
-
|
182
|
+
<notextile>
|
183
|
+
{% highlight ruby %}
|
151
184
|
DOJO = '0.2.2'
|
152
185
|
|
153
186
|
url = "http://download.dojotoolkit.org/release-#{DOJO}/dojo-#{DOJO}-widget.zip"
|
154
187
|
download(artifact("dojo:dojo:zip:widget:#{DOJO}")=>url)
|
155
|
-
}
|
188
|
+
{% endhighlight %}
|
189
|
+
</notextile>
|
156
190
|
|
157
191
|
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.
|
158
192
|
|
@@ -169,7 +203,7 @@ Since we ordered the calls to @artifact@ first and @download@ second, we know th
|
|
169
203
|
Magic.
|
170
204
|
|
171
205
|
|
172
|
-
h2. Install and Upload
|
206
|
+
h2(#install_upload). Install and Upload
|
173
207
|
|
174
208
|
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.
|
175
209
|
|
@@ -177,18 +211,22 @@ Some artifacts do not fall into either category. In this example we're going to
|
|
177
211
|
|
178
212
|
So let's start by creating a task that downloads the ZIP, and another one to extract it and create the JAR file:
|
179
213
|
|
180
|
-
|
214
|
+
<notextile>
|
215
|
+
{% highlight ruby %}
|
181
216
|
app_zip = download('target/app.zip'=>url)
|
182
217
|
bean_jar = file('target/app/bean.jar'=>unzip('target/app'=>app_zip))
|
183
|
-
}
|
218
|
+
{% endhighlight %}
|
219
|
+
</notextile>
|
184
220
|
|
185
221
|
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.
|
186
222
|
|
187
223
|
So the next step is to specify the artifact and tell it to use the extracted JAR file:
|
188
224
|
|
189
|
-
|
225
|
+
<notextile>
|
226
|
+
{% highlight ruby %}
|
190
227
|
bean = artifact('example.com:beans:jar:1.0').from(bean_jar)
|
191
|
-
}
|
228
|
+
{% endhighlight %}
|
229
|
+
</notextile>
|
192
230
|
|
193
231
|
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.
|
194
232
|
|
@@ -196,10 +234,12 @@ Use the @install@ method if you want the artifact and its POM installed in the l
|
|
196
234
|
|
197
235
|
Our example ends by including the artifact in the @install@ and @upload@ tasks:
|
198
236
|
|
199
|
-
|
237
|
+
<notextile>
|
238
|
+
{% highlight ruby %}
|
200
239
|
install bean
|
201
240
|
upload bean
|
202
|
-
}
|
241
|
+
{% endhighlight %}
|
242
|
+
</notextile>
|
203
243
|
|
204
244
|
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@.
|
205
245
|
|