buildr 1.2.10 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +566 -268
- data/DISCLAIMER +7 -1
- data/KEYS +151 -0
- data/NOTICE +23 -8
- data/README +122 -22
- data/Rakefile +49 -229
- data/{lib → addon}/buildr/antlr.rb +23 -10
- data/addon/buildr/cobertura.rb +232 -0
- data/{lib → addon}/buildr/hibernate.rb +20 -4
- data/{lib → addon}/buildr/javacc.rb +27 -12
- data/addon/buildr/jdepend.rb +60 -0
- data/{lib → addon}/buildr/jetty.rb +34 -18
- data/addon/buildr/nailgun.rb +892 -0
- data/{lib → addon}/buildr/openjpa.rb +23 -6
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/{lib/buildr/jetty → addon/buildr/org/apache/buildr}/JettyWrapper.java +19 -0
- data/{lib → addon}/buildr/xmlbeans.rb +39 -14
- data/bin/buildr +21 -7
- data/buildr.gemspec +50 -0
- data/doc/css/default.css +225 -0
- data/doc/css/print.css +95 -0
- data/doc/css/syntax.css +43 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +317 -0
- data/doc/pages/building.textile +501 -0
- data/doc/pages/contributing.textile +178 -0
- data/doc/pages/download.textile +25 -0
- data/doc/pages/extending.textile +229 -0
- data/doc/pages/getting_started.textile +337 -0
- data/doc/pages/index.textile +63 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +367 -0
- data/doc/pages/packaging.textile +592 -0
- data/doc/pages/projects.textile +449 -0
- data/doc/pages/recipes.textile +127 -0
- data/doc/pages/settings_profiles.textile +339 -0
- data/doc/pages/testing.textile +475 -0
- data/doc/pages/troubleshooting.textile +121 -0
- data/doc/pages/whats_new.textile +389 -0
- data/doc/print.haml +52 -0
- data/doc/print.toc.yaml +28 -0
- data/doc/scripts/buildr-git.rb +411 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +55 -0
- data/doc/site.toc.yaml +44 -0
- data/lib/buildr.rb +28 -45
- data/lib/buildr/core.rb +27 -0
- data/lib/buildr/core/application.rb +373 -0
- data/lib/buildr/core/application_cli.rb +134 -0
- data/lib/{core → buildr/core}/build.rb +91 -77
- data/lib/{core → buildr/core}/checks.rb +116 -95
- data/lib/buildr/core/common.rb +155 -0
- data/lib/buildr/core/compile.rb +594 -0
- data/lib/buildr/core/environment.rb +120 -0
- data/lib/buildr/core/filter.rb +258 -0
- data/lib/{core → buildr/core}/generate.rb +22 -5
- data/lib/buildr/core/help.rb +118 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/{core → buildr/core}/project.rb +468 -213
- data/lib/buildr/core/test.rb +690 -0
- data/lib/{core → buildr/core}/transports.rb +107 -127
- data/lib/buildr/core/util.rb +235 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/{java → buildr/ide}/eclipse.rb +86 -60
- data/lib/{java → buildr/ide}/idea.ipr.template +16 -0
- data/lib/buildr/ide/idea.rb +194 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +210 -0
- data/lib/buildr/java.rb +26 -0
- data/lib/buildr/java/ant.rb +71 -0
- data/lib/buildr/java/bdd_frameworks.rb +267 -0
- data/lib/buildr/java/commands.rb +210 -0
- data/lib/buildr/java/compilers.rb +432 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/groovyc.rb +137 -0
- data/lib/buildr/java/jruby.rb +99 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail.class +0 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail.java +41 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +116 -0
- data/lib/buildr/java/packaging.rb +706 -0
- data/lib/{java → buildr/java}/pom.rb +20 -4
- data/lib/buildr/java/rjb.rb +142 -0
- data/lib/buildr/java/test_frameworks.rb +290 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +21 -0
- data/lib/{java → buildr/packaging}/artifact.rb +170 -179
- data/lib/buildr/packaging/artifact_namespace.rb +957 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/{tasks → buildr/packaging}/tar.rb +18 -1
- data/lib/{tasks → buildr/packaging}/zip.rb +153 -105
- data/rakelib/apache.rake +126 -0
- data/rakelib/changelog.rake +56 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +44 -0
- data/rakelib/release.rake +53 -0
- data/rakelib/rspec.rake +81 -0
- data/rakelib/rubyforge.rake +45 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +59 -0
- data/rakelib/stage.rake +45 -0
- data/spec/application_spec.rb +316 -0
- data/spec/archive_spec.rb +494 -0
- data/spec/artifact_namespace_spec.rb +635 -0
- data/spec/artifact_spec.rb +738 -0
- data/spec/build_spec.rb +193 -0
- data/spec/checks_spec.rb +537 -0
- data/spec/common_spec.rb +579 -0
- data/spec/compile_spec.rb +561 -0
- data/spec/groovy_compilers_spec.rb +239 -0
- data/spec/java_bdd_frameworks_spec.rb +238 -0
- data/spec/java_compilers_spec.rb +446 -0
- data/spec/java_packaging_spec.rb +1042 -0
- data/spec/java_test_frameworks_spec.rb +414 -0
- data/spec/packaging_helper.rb +63 -0
- data/spec/packaging_spec.rb +589 -0
- data/spec/project_spec.rb +739 -0
- data/spec/sandbox.rb +116 -0
- data/spec/scala_compilers_spec.rb +239 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helpers.rb +283 -0
- data/spec/test_spec.rb +871 -0
- data/spec/transport_spec.rb +300 -0
- data/spec/version_requirement_spec.rb +115 -0
- metadata +188 -77
- data/lib/buildr/cobertura.rb +0 -89
- data/lib/buildr/jdepend.rb +0 -40
- data/lib/buildr/jetty/JettyWrapper$1.class +0 -0
- data/lib/buildr/jetty/JettyWrapper$BuildrHandler.class +0 -0
- data/lib/buildr/jetty/JettyWrapper.class +0 -0
- data/lib/buildr/scala.rb +0 -368
- data/lib/core/application.rb +0 -188
- data/lib/core/common.rb +0 -562
- data/lib/core/help.rb +0 -72
- data/lib/core/rake_ext.rb +0 -81
- data/lib/java/ant.rb +0 -71
- data/lib/java/compile.rb +0 -589
- data/lib/java/idea.rb +0 -159
- data/lib/java/java.rb +0 -432
- data/lib/java/packaging.rb +0 -581
- data/lib/java/test.rb +0 -795
- data/lib/tasks/concat.rb +0 -35
@@ -0,0 +1,121 @@
|
|
1
|
+
h1. Troubleshooting
|
2
|
+
|
3
|
+
Common troubleshooting tips collected from the mailing list.
|
4
|
+
|
5
|
+
|
6
|
+
h2. Running out of heap space
|
7
|
+
|
8
|
+
You can give the JVM more heap space by setting the @JAVA_OPTS@ environment
|
9
|
+
variables. This environment variable provides arguments for staring the JVM.
|
10
|
+
For example, to set the heap space to 1GB:
|
11
|
+
|
12
|
+
{{{!sh
|
13
|
+
$ export "JAVA_OPTS=-Xms1g -Xmx1g"
|
14
|
+
$ buildr compile
|
15
|
+
}}}
|
16
|
+
|
17
|
+
If you're sharing the build with other developers, you'll want to specify these
|
18
|
+
options in the Buildfile itself. You can set the environment variable within
|
19
|
+
the Buildfile, but make sure to do so at the very top of the Buildfile.
|
20
|
+
|
21
|
+
For example:
|
22
|
+
|
23
|
+
{{{!ruby
|
24
|
+
ENV['JAVA_OPTS'] = '-Xms1g -Xmx1g'
|
25
|
+
}}}
|
26
|
+
|
27
|
+
|
28
|
+
h2. RJB fails to compile
|
29
|
+
|
30
|
+
On Linux, BSD and Cygwin, RJB locates the JDK headers files -- which it uses to
|
31
|
+
compile a native C extension -- based on the @JAVA_HOME@ environment variable.
|
32
|
+
Make sure @JAVA_HOME@ points to the JDK, not JRE.
|
33
|
+
|
34
|
+
If you are using @sudo gem install@, note that some environments do not pass
|
35
|
+
the @JAVA_HOME@ environment variable over to @sudo@. To get around this, run
|
36
|
+
@gem@ with the @env JAVA_HOME=$JAVA_HOME@ option:
|
37
|
+
|
38
|
+
{{{!sh
|
39
|
+
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
|
40
|
+
}}}
|
41
|
+
|
42
|
+
|
43
|
+
h2. Segmentation Fault when running Java code
|
44
|
+
|
45
|
+
This is most likely a JVM inconsistency, for example, when part of the RJB
|
46
|
+
library uses JDK 1.6, the other part uses JDK 1.5.
|
47
|
+
|
48
|
+
During installation RJB builds a native C extension using header files supplied by
|
49
|
+
the JVM, and compiles a Java bridge class using the Javac. It is possible for RJB
|
50
|
+
to use two different versions of the JVM, for example, if @JAVA_HOME@ points to
|
51
|
+
JDK 1.5, but @/usr/bin/javac@ points to JDK 1.6.
|
52
|
+
|
53
|
+
Make sure @JAVA_HOME@ and @/usr/bin/javac@ both point to the same JDK:
|
54
|
+
|
55
|
+
{{{!sh
|
56
|
+
echo $JAVA_HOME
|
57
|
+
ls -l /usr/bin/javac
|
58
|
+
}}}
|
59
|
+
|
60
|
+
*Note:* It seems that RJB works with Java 6, except when it doesn't, and for a
|
61
|
+
few people it doesn't. In that case, either switch to Java 1.5, or simply run
|
62
|
+
Buildr on JRuby using Java 6.
|
63
|
+
|
64
|
+
|
65
|
+
h2. Bugs resulting from a dangling comma or period
|
66
|
+
|
67
|
+
Ruby statements don't need a delimiter and can span multiple lines, which can
|
68
|
+
lead to bugs resulting from dangling commas and periods left at the end of the
|
69
|
+
line. For example:
|
70
|
+
|
71
|
+
{{{!ruby
|
72
|
+
compile.with 'org.apache.axis2:axis2:jar:1.2',
|
73
|
+
test.with 'log4j:log4j:jar:1.1'
|
74
|
+
}}}
|
75
|
+
|
76
|
+
This is actually a single method call with two arguments, separated by a comma.
|
77
|
+
The second argument is the result of calling @test.with@, and makes the test
|
78
|
+
task a pre-requisite of the compile task, leading to a circular dependency.
|
79
|
+
|
80
|
+
As you can imagine this happens usually after editing, specifically for commas
|
81
|
+
and periods which are small enough that you won't notice them from a cursory
|
82
|
+
glance at the code, so if all else fails, search for lines that end with one of
|
83
|
+
these characters.
|
84
|
+
|
85
|
+
|
86
|
+
h2. Missing POM breaks transitive dependencies
|
87
|
+
|
88
|
+
Occasionally, artifacts are deployed to remote repositories with missing or
|
89
|
+
broken POMs. Buildr will fail when attempting to resolve transitive
|
90
|
+
dependencies with broken or missing POMs.
|
91
|
+
|
92
|
+
In this particular case, failing is doing the right thing. There's no way for
|
93
|
+
Buildr to tell whether the POM is nowhere to be found, or just a temporary
|
94
|
+
problem accessing the remote server.
|
95
|
+
|
96
|
+
If you can determine that the POM file is missing you can work around the
|
97
|
+
problem in three ways. If you published the artifact, make the release again,
|
98
|
+
getting it to upload the missing files.
|
99
|
+
|
100
|
+
If the source repository is not under your control, but you are also using your
|
101
|
+
own repository for the project, you can always create a dummy POM in your own
|
102
|
+
repository. Buildr will attempt to download the file from either repository,
|
103
|
+
using the first file it finds.
|
104
|
+
|
105
|
+
Alternatively, you can make Buildr create a dummy POM file in the local
|
106
|
+
repository, instead of downloading it from a remote repository. This example
|
107
|
+
creates a dummy POM for Axis JAX-RPC:
|
108
|
+
|
109
|
+
{{{!ruby
|
110
|
+
artifact 'axis:axis-jaxrpc:pom:1.3' do |task|
|
111
|
+
write task.name, <<-POM
|
112
|
+
<project>
|
113
|
+
<modelVersion>4.0.0</modelVersion>
|
114
|
+
<groupId>axis</groupId>
|
115
|
+
<artifactId>axis-jaxrpc</artifactId>
|
116
|
+
<version>1.4</version>
|
117
|
+
</project>
|
118
|
+
POM
|
119
|
+
end
|
120
|
+
}}}
|
121
|
+
|
@@ -0,0 +1,389 @@
|
|
1
|
+
h1. What's New
|
2
|
+
|
3
|
+
h2. Buildr 1.3
|
4
|
+
|
5
|
+
h3. Multiple Languages
|
6
|
+
|
7
|
+
The main focus of this release is supporting multiple languages for compiling
|
8
|
+
and testing.
|
9
|
+
|
10
|
+
For each project, Buildr will attempt to infer which compiler to use based on
|
11
|
+
the source files it finds, for example, if it finds @.java@ files in the
|
12
|
+
@src/main/java@ directory, it will switch to the javac compiler, if it finds
|
13
|
+
@.scala@ files in the @src/main/scala@ directory, to the scalac compiler and so
|
14
|
+
forth.
|
15
|
+
|
16
|
+
Different compilers may use different target directory, @target/classes@ is
|
17
|
+
picked for JVM compilers (Java, Scala, Groovy, etc), so resources are not copied to
|
18
|
+
their own directory, @target/resources@. The prepare task has been removed.
|
19
|
+
|
20
|
+
Not all languages have classpaths, so @compile.classpath@ is now known as
|
21
|
+
@compile.dependencies@, but the old attribute still exists for backward
|
22
|
+
compatibility.
|
23
|
+
|
24
|
+
Also, for consistency, the test target directories have changed to
|
25
|
+
@target/test/classes@ and @target/test/resources@, respectively.
|
26
|
+
|
27
|
+
Speaking of tests, you can compile code in one language and use a different
|
28
|
+
language to test it, say, if you're interested in compiling Java code and
|
29
|
+
testing it with Ruby, or compiling Flash and running a Java test suite.
|
30
|
+
|
31
|
+
As before, you can pick the test framework by calling
|
32
|
+
@test.using(<framework>)@. Buildr will attempt to pick one by default, for
|
33
|
+
example, if the tests are written in Java, it will default to JUnit.
|
34
|
+
|
35
|
+
And, since not all languages package to JARs, the default packaging is either
|
36
|
+
inferred from the compiler (so @:jar@ when compiling Java code), otherwise to
|
37
|
+
@:zip@. All this defaulting means that @package()@ with no arguments does the
|
38
|
+
right thing in more cases, and most probably won't break anyone's buildfiles.
|
39
|
+
|
40
|
+
I've tried to keep the compiler API as simple as possible, making it easy to
|
41
|
+
add new compilers; however, I had to change the test framework API to
|
42
|
+
accommodate the new features, so old test frameworks will not work on 1.3.
|
43
|
+
|
44
|
+
|
45
|
+
h3. Scala Support
|
46
|
+
|
47
|
+
Buildr now supports Scala, using both native and fast Scala compiler.
|
48
|
+
|
49
|
+
Read more about "using Scala":building.html#compiling_scala.
|
50
|
+
|
51
|
+
|
52
|
+
h3. Groovy Support
|
53
|
+
|
54
|
+
Buildr now supports Groovy, using the Groovyc Ant task.
|
55
|
+
|
56
|
+
Read more about "using Groovy":building.html#compiling_groovy.
|
57
|
+
|
58
|
+
|
59
|
+
h3. Packaging Files
|
60
|
+
|
61
|
+
The @package@ method is convenient enough that you can now use it to generate
|
62
|
+
artifacts, an in addition to generate regular file tasks, specifying the file
|
63
|
+
name using the @:file@ attribute. For example:
|
64
|
+
|
65
|
+
{{{!ruby
|
66
|
+
package :zip, :file=>_('target/interesting.zip')
|
67
|
+
}}}
|
68
|
+
|
69
|
+
Since this package is not an artifact and does not have a specification, it
|
70
|
+
will not automatically install itself in the local repository or upload to a
|
71
|
+
remote repository. For these, use the @package@ method as before.
|
72
|
+
|
73
|
+
Read more about "the package
|
74
|
+
method":packaging.html#specifying_and_referencing_packages.
|
75
|
+
|
76
|
+
|
77
|
+
h3. Packaging EARs
|
78
|
+
|
79
|
+
EAR packages support four component types:
|
80
|
+
|
81
|
+
|_. Argument |_. Component |
|
82
|
+
| @:war@ | J2EE Web Application (WAR). |
|
83
|
+
| @:ejb@ | Enterprise Java Bean (JAR). |
|
84
|
+
| @:jar@ | J2EE Application Client (JAR). |
|
85
|
+
| @:lib@ | Shared library (JAR). |
|
86
|
+
|
87
|
+
This example shows two ways for adding components built by other projects:
|
88
|
+
|
89
|
+
{{{!ruby
|
90
|
+
package(:ear) << project('coolWebService').package(:war)
|
91
|
+
package(:ear).add project('commonLib') # By default, the JAR package
|
92
|
+
}}}
|
93
|
+
|
94
|
+
EAR packages include an @application.xml@ file in the @META-INF@ directory that
|
95
|
+
describes the application and its component. This file is created for you
|
96
|
+
during packaging, by referencing all the components added to the EAR. There
|
97
|
+
are a couple of things you will typically want to change.
|
98
|
+
|
99
|
+
* *display-name* -- The application's display name defaults to the project's
|
100
|
+
identifier. You can change that by setting the @display_name@ attribute.
|
101
|
+
|
102
|
+
* *context-root* -- WAR components specify a context root, based on the package
|
103
|
+
identifier, for example, "cool-web-1.0.war" will have the context root
|
104
|
+
"cool-web". To specify a different context root, add the WAR package with the
|
105
|
+
@context_root@ option.
|
106
|
+
|
107
|
+
"Read more ...":packaging.html#packaging_ears
|
108
|
+
|
109
|
+
|
110
|
+
h3. JRuby Support
|
111
|
+
|
112
|
+
We now offer two versions of Buildr, one for Ruby and one for JRuby. They're
|
113
|
+
exactly the same, except the Ruby version will also install RJB (Ruby Java
|
114
|
+
Bridge), the JRuby version obviously can do well without it.
|
115
|
+
|
116
|
+
"Read more ...":download.html#jruby
|
117
|
+
|
118
|
+
Buildr provides a "Nailgun":http://www.martiansoftware.com/nailgun/index.html
|
119
|
+
server when running on JRuby. Using the integrated BuildrServer allows for
|
120
|
+
faster task execution and avoid frequent JVM startup overhead.
|
121
|
+
|
122
|
+
"Read more ...":more_stuff.html#nailgun
|
123
|
+
|
124
|
+
|
125
|
+
h3. Behaviour-Driven Development
|
126
|
+
|
127
|
+
Given that many languages are now supported by Buildr, the same is true for
|
128
|
+
testing, the convention is to store BDD files under the @src/spec/{lang}@
|
129
|
+
directory.
|
130
|
+
The following table shows the framework's name you can use to select them
|
131
|
+
for your projects. Buildr follows each framework's naming convention.
|
132
|
+
|
133
|
+
|_. test.using |_. Test file name convention |
|
134
|
+
| @:jbehave@ | @src/spec/java/**/*Behaviour.java@ |
|
135
|
+
| @:rspec@ | @src/spec/ruby/**/*_spec.rb@ |
|
136
|
+
| @:easyb@ | @src/spec/groovy/**/*{Story,Behavior}.groovy@ |
|
137
|
+
|
138
|
+
"Read more ...":testing.html#bdd
|
139
|
+
|
140
|
+
|
141
|
+
h3. Profiles
|
142
|
+
|
143
|
+
Different environments may require different configurations, some you will want
|
144
|
+
to control with code, others you will want to specify in the profiles file.
|
145
|
+
|
146
|
+
The profiles file is a YAML file called @profiles.yaml@ that you place in the
|
147
|
+
same directory as the Buildfile. We selected YAML because it's easier to read
|
148
|
+
and edit than XML.
|
149
|
+
|
150
|
+
For example, to support three different database configurations, we could write:
|
151
|
+
|
152
|
+
{{{!yaml
|
153
|
+
# HSQL, don't bother storing to disk.
|
154
|
+
development:
|
155
|
+
db: hsql
|
156
|
+
jdbc: hsqldb:mem:devdb
|
157
|
+
|
158
|
+
# Make sure we're not messing with bigstrong.
|
159
|
+
test:
|
160
|
+
db: oracle
|
161
|
+
jdbc: oracle:thin:@localhost:1521:test
|
162
|
+
|
163
|
+
# The real deal.
|
164
|
+
production:
|
165
|
+
db: oracle
|
166
|
+
jdbc: oracle:thin:@bigstrong:1521:mighty
|
167
|
+
}}}
|
168
|
+
|
169
|
+
You can also use profiles to specify default filters for the "@resources@
|
170
|
+
task":building.html#resources.
|
171
|
+
|
172
|
+
"Read more ...":settings_profiles.html#profiles
|
173
|
+
|
174
|
+
|
175
|
+
h3. Settings and build YAML files
|
176
|
+
|
177
|
+
In addition to profiles, we also allow you to specify personal and build
|
178
|
+
settings using two YAML files.
|
179
|
+
|
180
|
+
Personal settings are placed in the @.buildr/settings.yaml@ file under your
|
181
|
+
home directory. Settings stored there will be applied the same across all
|
182
|
+
builds.
|
183
|
+
|
184
|
+
For example:
|
185
|
+
|
186
|
+
{{{!yaml
|
187
|
+
# The repositories hash is read automatically by buildr.
|
188
|
+
repositories:
|
189
|
+
|
190
|
+
# customize user local maven2 repository location
|
191
|
+
local: some/path/to/my_repo
|
192
|
+
|
193
|
+
relase_to:
|
194
|
+
url: http://intra.net/maven2
|
195
|
+
username: john
|
196
|
+
password: secret
|
197
|
+
|
198
|
+
# You can place settings of your own, and reference them
|
199
|
+
# on buildfiles.
|
200
|
+
im:
|
201
|
+
server: jabber.company.com
|
202
|
+
usr: notifier@company-jabber.com
|
203
|
+
pwd: secret
|
204
|
+
}}}
|
205
|
+
|
206
|
+
"Read more ...":settings_profiles.html#personal_settings
|
207
|
+
|
208
|
+
Build settings are placed in the @build.yaml@ file located in the same
|
209
|
+
directory that the @buildfile@. Normally this file would be managed by the
|
210
|
+
project revision control system, so settings here are shared between
|
211
|
+
developers.
|
212
|
+
|
213
|
+
For example:
|
214
|
+
|
215
|
+
{{{!yaml
|
216
|
+
# This project requires the following ruby gems, buildr addons
|
217
|
+
gems:
|
218
|
+
# Suppose we want to notify developers when testcases fail.
|
219
|
+
- buildr-twitter-notifier-addon >=1
|
220
|
+
# we test with ruby mock objects
|
221
|
+
- mocha
|
222
|
+
- ci_reporter
|
223
|
+
|
224
|
+
# The artifact declarations will be automatically loaded by buildr, so that
|
225
|
+
# you can reference artifacts by name (a ruby-symbol) on your buildfile.
|
226
|
+
artifacts:
|
227
|
+
spring: org.springframework:spring:jar:2.0
|
228
|
+
log4j: log4j:log4j:jar:1.0
|
229
|
+
j2ee: geronimo-spec:geronimo-spec:j2ee:jar:1.4-rc4
|
230
|
+
|
231
|
+
# Of course project settings can be defined here
|
232
|
+
jira:
|
233
|
+
uri: https://jira.corp.org
|
234
|
+
}}}
|
235
|
+
|
236
|
+
"Read more ...":settings_profiles.html#build_settings
|
237
|
+
|
238
|
+
|
239
|
+
h3. Using Gems for extensions and 3rd party libraries
|
240
|
+
|
241
|
+
"RubyGems":http://rubygems.rubyforge.org provides the @gem@ command line tool
|
242
|
+
that you can use to search, install, upgrade, package and distribute gems. It
|
243
|
+
installs all gems into a local repository that is shared across your builds and
|
244
|
+
all other Ruby applications you may have running. You can install a gem from a
|
245
|
+
local file, or download and install it from any number of remote repositories.
|
246
|
+
|
247
|
+
If your build depends on other gems, you will want to specify these
|
248
|
+
dependencies as part of your build and check that configuration into source
|
249
|
+
control. That way you can have a specific environment that will guarantee
|
250
|
+
repeatable builds, whether you're building a particular version, moving between
|
251
|
+
branches, or joining an existing project. Buildr will take care of installing
|
252
|
+
all the necessary dependencies, which you can then manage with the @gem@
|
253
|
+
command.
|
254
|
+
|
255
|
+
Use the @build.yaml@ file to specify these dependencies (see "Build
|
256
|
+
Settings":settings_profiles.html#build_settings for more information), for
|
257
|
+
example:
|
258
|
+
|
259
|
+
{{{!yaml
|
260
|
+
# This project requires the following gems
|
261
|
+
gems:
|
262
|
+
# Suppose we want to notify developers when testcases fail.
|
263
|
+
- buildr-twitter-notifier-addon >=1
|
264
|
+
# we test with ruby mock objects
|
265
|
+
- mocha
|
266
|
+
- ci_reporter
|
267
|
+
}}}
|
268
|
+
|
269
|
+
"Read more ...":more_stuff.html#using_gems
|
270
|
+
|
271
|
+
|
272
|
+
h3. New API for accessing Java libraries
|
273
|
+
|
274
|
+
Java classes are accessed as static methods on the @Java@ module, for example:
|
275
|
+
|
276
|
+
{{{!ruby
|
277
|
+
str = Java.java.lang.String.new('hai!')
|
278
|
+
str.toUpperCase
|
279
|
+
=> 'HAI!'
|
280
|
+
Java.java.lang.String.isInstance(str)
|
281
|
+
=> true
|
282
|
+
Java.com.sun.tools.javac.Main.compile(args)
|
283
|
+
}}}
|
284
|
+
|
285
|
+
The @classpath@ attribute allows Buildr to add JARs and directories to the
|
286
|
+
classpath, for example, we use it to load Ant and various Ant tasks, code
|
287
|
+
generators, test frameworks, and so forth.
|
288
|
+
|
289
|
+
For example, Ant is loaded as follows:
|
290
|
+
|
291
|
+
{{{!ruby
|
292
|
+
Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
|
293
|
+
}}}
|
294
|
+
|
295
|
+
Artifacts can only be downloaded after the Buildfile has loaded, giving it a
|
296
|
+
chance to specify which remote repositories to use, so adding to classpath does
|
297
|
+
not by itself load any libraries. You must call @Java.load@ before accessing any
|
298
|
+
Java classes to give Buildr a chance to load the libraries specified in the
|
299
|
+
classpath.
|
300
|
+
|
301
|
+
"Read more ...":more_stuff.html#using_java_libraries
|
302
|
+
|
303
|
+
|
304
|
+
h3. Creating Extensions
|
305
|
+
|
306
|
+
A module defines instance methods that are then mixed into the project and
|
307
|
+
become instance methods of the project. There are two general ways for
|
308
|
+
extending projects. You can extend all projects by including the module in
|
309
|
+
Project:
|
310
|
+
|
311
|
+
{{{!ruby
|
312
|
+
class Project
|
313
|
+
include MyExtension
|
314
|
+
end
|
315
|
+
}}}
|
316
|
+
|
317
|
+
You can also extend a given project instance and only that instance by
|
318
|
+
extending it with the module:
|
319
|
+
|
320
|
+
{{{!ruby
|
321
|
+
define 'foo' do
|
322
|
+
extend MyExtension
|
323
|
+
end
|
324
|
+
}}}
|
325
|
+
|
326
|
+
Some extensions require tighter integration with the project, specifically for
|
327
|
+
setting up tasks and properties, or for configuring tasks based on the project
|
328
|
+
definition. You can do that by adding callbacks to the process.
|
329
|
+
|
330
|
+
"Read more ...":extending.html#creating_extensions
|
331
|
+
|
332
|
+
|
333
|
+
h3. Using Alternative Layouts
|
334
|
+
|
335
|
+
Buildr follows a common convention for project layouts: Java source files
|
336
|
+
appear in @src/main/java@ and compile to @target/classes@, resources are
|
337
|
+
copied over from @src/main/resources@ and so forth. Not all projects follow
|
338
|
+
this convention, so it's now possible to specify an alternative project
|
339
|
+
layout.
|
340
|
+
|
341
|
+
A layout is an object that implements the @expand@ method. The easiest way to
|
342
|
+
define a custom layout is to create a new @Layout@ object and specify mapping
|
343
|
+
between names used by Buildr and actual paths within the project.
|
344
|
+
|
345
|
+
"Read more ...":extending.html#using_alternative_layouts
|
346
|
+
|
347
|
+
|
348
|
+
h3. Other
|
349
|
+
|
350
|
+
* Buildr 1.3 upgrades to Rake 0.8, RSpec 1.1, RJB 1.1 and OpenJPA
|
351
|
+
1.0.1. Buildr no longer includes or uses Facets.
|
352
|
+
|
353
|
+
* JUnit tests now operate on all compiled test classes that extend
|
354
|
+
@junit.framework.TestCase@ or use the @Test@ annotation; TestNG test cases are
|
355
|
+
filtered by annotation. Test cases no longer have to use a specific file name.
|
356
|
+
|
357
|
+
* Remote repositories now support HTTP Basic Authentication.
|
358
|
+
|
359
|
+
* The prepare task has been removed, if you need to, simply add a prerequisite
|
360
|
+
to the compile task.
|
361
|
+
|
362
|
+
|
363
|
+
h3. Documentation
|
364
|
+
|
365
|
+
* The "What's new?":whats_new.html page (this one, actually), summarizes all
|
366
|
+
the important new features and changes in each release.
|
367
|
+
|
368
|
+
* The "Recipes":recipes.html page (also available in the PDF) lists recipes for
|
369
|
+
using Buildr, collected from the mailing list. Feel free to contribute tips,
|
370
|
+
tricks and techniques.
|
371
|
+
|
372
|
+
* The "Troubleshooting":troubleshooting.html page (also available in the PDF)
|
373
|
+
collects troubleshooting ideas from the mailing list.
|
374
|
+
|
375
|
+
* The "Getting Started":getting_started.html has been rewritten to cover all
|
376
|
+
you need to know about downloading and installing Buildr on Linux, OS/X,
|
377
|
+
Windows and with JRuby (1.1 or later).
|
378
|
+
|
379
|
+
* A new "Contributing":contributing.html page has more details on how to file
|
380
|
+
bugs, policy for submitting patches, running Buildr test cases, and helping
|
381
|
+
with the documentation.
|
382
|
+
|
383
|
+
* A new page for "Settings and Profiles":settings_profiles.html.
|
384
|
+
|
385
|
+
* The "Extending Buildr":extending.html page that deals with writing your own
|
386
|
+
tasks, creating extensions and specifying alternative layouts.
|
387
|
+
|
388
|
+
* The site also includes "RSpec report":specs.html and "Test coverage
|
389
|
+
report":coverage/index.html.
|