realityforge-buildr 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/LICENSE +176 -0
  4. data/NOTICE +26 -0
  5. data/README.md +3 -0
  6. data/Rakefile +50 -0
  7. data/addon/buildr/checkstyle-report.xsl +104 -0
  8. data/addon/buildr/checkstyle.rb +254 -0
  9. data/addon/buildr/git_auto_version.rb +36 -0
  10. data/addon/buildr/gpg.rb +90 -0
  11. data/addon/buildr/gwt.rb +413 -0
  12. data/addon/buildr/jacoco.rb +161 -0
  13. data/addon/buildr/pmd.rb +185 -0
  14. data/addon/buildr/single_intermediate_layout.rb +71 -0
  15. data/addon/buildr/spotbugs.rb +265 -0
  16. data/addon/buildr/top_level_generate_dir.rb +37 -0
  17. data/addon/buildr/wsgen.rb +192 -0
  18. data/bin/buildr +20 -0
  19. data/buildr.gemspec +61 -0
  20. data/lib/buildr.rb +86 -0
  21. data/lib/buildr/core/application.rb +705 -0
  22. data/lib/buildr/core/assets.rb +96 -0
  23. data/lib/buildr/core/build.rb +587 -0
  24. data/lib/buildr/core/common.rb +167 -0
  25. data/lib/buildr/core/compile.rb +599 -0
  26. data/lib/buildr/core/console.rb +124 -0
  27. data/lib/buildr/core/doc.rb +275 -0
  28. data/lib/buildr/core/environment.rb +128 -0
  29. data/lib/buildr/core/filter.rb +405 -0
  30. data/lib/buildr/core/help.rb +114 -0
  31. data/lib/buildr/core/progressbar.rb +161 -0
  32. data/lib/buildr/core/project.rb +994 -0
  33. data/lib/buildr/core/test.rb +776 -0
  34. data/lib/buildr/core/transports.rb +456 -0
  35. data/lib/buildr/core/util.rb +77 -0
  36. data/lib/buildr/ide/idea.rb +1664 -0
  37. data/lib/buildr/java/commands.rb +230 -0
  38. data/lib/buildr/java/compiler.rb +85 -0
  39. data/lib/buildr/java/custom_pom.rb +300 -0
  40. data/lib/buildr/java/doc.rb +62 -0
  41. data/lib/buildr/java/packaging.rb +393 -0
  42. data/lib/buildr/java/pom.rb +191 -0
  43. data/lib/buildr/java/test_result.rb +54 -0
  44. data/lib/buildr/java/tests.rb +111 -0
  45. data/lib/buildr/packaging/archive.rb +586 -0
  46. data/lib/buildr/packaging/artifact.rb +1113 -0
  47. data/lib/buildr/packaging/artifact_namespace.rb +1010 -0
  48. data/lib/buildr/packaging/artifact_search.rb +138 -0
  49. data/lib/buildr/packaging/package.rb +237 -0
  50. data/lib/buildr/packaging/version_requirement.rb +189 -0
  51. data/lib/buildr/packaging/zip.rb +189 -0
  52. data/lib/buildr/packaging/ziptask.rb +387 -0
  53. data/lib/buildr/version.rb +18 -0
  54. data/rakelib/release.rake +99 -0
  55. data/spec/addon/checkstyle_spec.rb +58 -0
  56. data/spec/core/application_spec.rb +576 -0
  57. data/spec/core/build_spec.rb +922 -0
  58. data/spec/core/common_spec.rb +670 -0
  59. data/spec/core/compile_spec.rb +656 -0
  60. data/spec/core/console_spec.rb +65 -0
  61. data/spec/core/doc_spec.rb +194 -0
  62. data/spec/core/extension_spec.rb +200 -0
  63. data/spec/core/project_spec.rb +736 -0
  64. data/spec/core/test_spec.rb +1131 -0
  65. data/spec/core/transport_spec.rb +452 -0
  66. data/spec/core/util_spec.rb +154 -0
  67. data/spec/ide/idea_spec.rb +1952 -0
  68. data/spec/java/commands_spec.rb +79 -0
  69. data/spec/java/compiler_spec.rb +274 -0
  70. data/spec/java/custom_pom_spec.rb +165 -0
  71. data/spec/java/doc_spec.rb +55 -0
  72. data/spec/java/packaging_spec.rb +786 -0
  73. data/spec/java/pom_spec.rb +162 -0
  74. data/spec/java/test_coverage_helper.rb +257 -0
  75. data/spec/java/tests_spec.rb +224 -0
  76. data/spec/packaging/archive_spec.rb +686 -0
  77. data/spec/packaging/artifact_namespace_spec.rb +757 -0
  78. data/spec/packaging/artifact_spec.rb +1351 -0
  79. data/spec/packaging/packaging_helper.rb +63 -0
  80. data/spec/packaging/packaging_spec.rb +690 -0
  81. data/spec/sandbox.rb +166 -0
  82. data/spec/spec_helpers.rb +420 -0
  83. data/spec/version_requirement_spec.rb +145 -0
  84. data/spec/xpath_matchers.rb +123 -0
  85. metadata +295 -0
@@ -0,0 +1,79 @@
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
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
17
+
18
+
19
+ describe Java::Commands do
20
+ describe "Java::Commands.javac" do
21
+
22
+ it "should compile java" do
23
+ write "Foo.java", "public class Foo {}"
24
+ lambda { Java::Commands.javac("Foo.java") }.should change {File.exist?("Foo.class")}.to(true)
25
+ end
26
+
27
+ it 'should let the user specify an output directory' do
28
+ write "Foo.java", "public class Foo {}"
29
+ lambda { Java::Commands.javac("Foo.java", :output => "classes") }.should change {File.exist?("classes/Foo.class")}.to(true)
30
+ end
31
+
32
+ it "should let the user specify a different name" do
33
+ write "Foo.java", "public class Foo {}"
34
+ lambda { Java::Commands.javac("Foo.java", :name => "bar") }.should show_info("Compiling 1 source files in bar")
35
+ end
36
+
37
+ it "should let the user specify a source path" do
38
+ write "ext/org/Bar.java", "package org; public class Bar {}"
39
+ write "Foo.java", "import org.Bar;\n public class Foo {}"
40
+ lambda { Java::Commands.javac("Foo.java", :sourcepath => File.expand_path("ext")) }.should change {File.exist?("Foo.class")}.to(true)
41
+ end
42
+
43
+ it "should let the user specify a classpath" do
44
+ write "ext/org/Bar.java", "package org; public class Bar {}"
45
+ Java::Commands.javac("ext/org/Bar.java", :output => "lib")
46
+ write "Foo.java", "import org.Bar;\n public class Foo {}"
47
+ lambda { Java::Commands.javac("Foo.java", :classpath => File.expand_path("lib")) }.should change {File.exist?("Foo.class")}.to(true)
48
+ end
49
+ end
50
+
51
+ describe "Java::Commands.javadoc" do
52
+
53
+ it "should fail if no output is defined" do
54
+ lambda { Java::Commands.javadoc("Foo.java") }.should raise_error(/No output defined for javadoc/)
55
+ end
56
+
57
+ it "should create javadoc" do
58
+ write "Foo.java", "public class Foo {}"
59
+ lambda { Java::Commands.javadoc("Foo.java", :output => "doc") }.should change {File.exist?("doc/Foo.html")}.to(true)
60
+ end
61
+
62
+ it "should accept file tasks as arguments" do
63
+ foo = file("Foo.java") do |file|
64
+ file.enhance do
65
+ write file.to_s, "public class Foo {}"
66
+ end
67
+ end
68
+ lambda { Java::Commands.javadoc(foo, :output => "doc") }.should change {File.exist?("doc/Foo.html")}.to(true)
69
+ end
70
+
71
+ it "should accept projects as arguments" do
72
+ write "src/main/java/Foo.java", "public class Foo {}"
73
+ write "src/main/java/bar/Foobar.java", "package bar; public class Foobar {}"
74
+ define "foo" do
75
+ end
76
+ lambda { Java::Commands.javadoc(project("foo"), :output => "doc") }.should change {File.exist?("doc/Foo.html") && File.exist?("doc/bar/Foobar.html")}.to(true)
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,274 @@
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 File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
18
+
19
+
20
+ describe 'javac compiler' do
21
+ it 'should identify itself from source directories' do
22
+ write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
23
+ define('foo').compile.compiler.should eql(:javac)
24
+ end
25
+
26
+ it 'should identify from source directories using custom layout' do
27
+ write 'src/com/example/Code.java', 'package com.example; class Code {}'
28
+ write 'testing/com/example/Test.java', 'package com.example; class Test {}'
29
+ custom = Layout.new
30
+ custom[:source, :main, :java] = 'src'
31
+ custom[:source, :test, :java] = 'testing'
32
+ define 'foo', :layout=>custom do
33
+ compile.compiler.should eql(:javac)
34
+ test.compile.compiler.should eql(:javac)
35
+ end
36
+ end
37
+
38
+ it 'should identify from compile source directories' do
39
+ write 'src/com/example/Code.java', 'package com.example; class Code {}'
40
+ write 'testing/com/example/Test.java', 'package com.example; class Test {}'
41
+ define 'foo' do
42
+ lambda { compile.from 'src' }.should change { compile.compiler }.to(:javac)
43
+ lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:javac)
44
+ end
45
+ end
46
+
47
+ it 'should report the language as :java' do
48
+ define('foo').compile.using(:javac).language.should eql(:java)
49
+ end
50
+
51
+ it 'should set the target directory to target/classes' do
52
+ define 'foo' do
53
+ lambda { compile.using(:javac) }.should change { compile.target.to_s }.to(File.expand_path('target/classes'))
54
+ end
55
+ end
56
+
57
+ it 'should not override existing target directory' do
58
+ define 'foo' do
59
+ compile.into('classes')
60
+ lambda { compile.using(:javac) }.should_not change { compile.target }
61
+ end
62
+ end
63
+
64
+ it 'should accept a task to compile from' do
65
+ p = define 'foo' do
66
+ project.version = '1'
67
+ f = file(_(:target, :generated, 'myjava')) do
68
+ mkdir_p _(:target, :generated, 'myjava')
69
+ File.open("#{_(:target, :generated, 'myjava')}/Foo.java", "wb") do |f|
70
+ f.write "public class Foo {}"
71
+ end
72
+ end
73
+
74
+ compile.from(f)
75
+ package(:jar)
76
+ end.compile.invoke
77
+ file('target/classes/Foo.class').should exist
78
+ end
79
+
80
+ it 'should not change existing list of sources' do
81
+ define 'foo' do
82
+ compile.from('sources')
83
+ lambda { compile.using(:javac) }.should_not change { compile.sources }
84
+ end
85
+ end
86
+
87
+ it 'should include classpath dependencies' do
88
+ write 'src/dependency/Dependency.java', 'class Dependency {}'
89
+ define 'dependency', :version=>'1.0' do
90
+ compile.from('src/dependency').into('target/dependency')
91
+ package(:jar)
92
+ end
93
+ write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
94
+ define('foo').compile.from('src/test').with(project('dependency')).invoke
95
+ file('target/classes/DependencyTest.class').should exist
96
+ end
97
+
98
+ it 'should include tools.jar dependency' do
99
+ write 'src/main/java/UseJarSigner.java', <<-JAVA
100
+ import sun.tools.jar.Manifest;
101
+ public class UseJarSigner { }
102
+ JAVA
103
+ define('foo').compile.invoke
104
+ file('target/classes/UseJarSigner.class').should exist
105
+ end
106
+
107
+ it 'should ignore package-info.java files in up-to-date check' do
108
+ write 'src/main/java/foo/Test.java', 'package foo; class Test { public void foo() {} }'
109
+ write 'src/main/java/foo/package-info.java', 'package foo;'
110
+ lambda{ define('foo').compile.invoke }.should run_task('foo:compile')
111
+ lambda{ define('bar').compile.invoke }.should_not run_task('bar:compile')
112
+ end
113
+ end
114
+
115
+
116
+ describe 'javac compiler options' do
117
+ def compile_task
118
+ @compile_task ||= define('foo').compile.using(:javac)
119
+ end
120
+
121
+ def javac_args
122
+ compile_task.instance_eval { @compiler }.send(:javac_args)
123
+ end
124
+
125
+ it 'should set warnings option to false by default' do
126
+ compile_task.options.warnings.should be_false
127
+ end
128
+
129
+ it 'should set warnings option to true when running with --verbose option' do
130
+ verbose true
131
+ compile_task.options.warnings.should be_false
132
+ end
133
+
134
+ it 'should use -nowarn argument when warnings is false' do
135
+ compile_task.using(:warnings=>false)
136
+ javac_args.should include('-nowarn')
137
+ end
138
+
139
+ it 'should not use -nowarn argument when warnings is true' do
140
+ compile_task.using(:warnings=>true)
141
+ javac_args.should_not include('-nowarn')
142
+ end
143
+
144
+ it 'should not use -verbose argument by default' do
145
+ javac_args.should_not include('-verbose')
146
+ end
147
+
148
+ it 'should use -verbose argument when running with --trace=javac option' do
149
+ Buildr.application.options.trace_categories = [:javac]
150
+ javac_args.should include('-verbose')
151
+ end
152
+
153
+ it 'should set debug option to true by default' do
154
+ compile_task.options.debug.should be_true
155
+ end
156
+
157
+ it 'should set debug option to false based on Buildr.options' do
158
+ Buildr.options.debug = false
159
+ compile_task.options.debug.should be_false
160
+ end
161
+
162
+ it 'should set debug option to false based on debug environment variable' do
163
+ ENV['debug'] = 'no'
164
+ compile_task.options.debug.should be_false
165
+ end
166
+
167
+ it 'should set debug option to false based on DEBUG environment variable' do
168
+ ENV['DEBUG'] = 'no'
169
+ compile_task.options.debug.should be_false
170
+ end
171
+
172
+ it 'should use -g argument when debug option is true' do
173
+ compile_task.using(:debug=>true)
174
+ javac_args.should include('-g')
175
+ end
176
+
177
+ it 'should not use -g argument when debug option is false' do
178
+ compile_task.using(:debug=>false)
179
+ javac_args.should_not include('-g')
180
+ end
181
+
182
+ it 'should set deprecation option to false by default' do
183
+ compile_task.options.deprecation.should be_false
184
+ end
185
+
186
+ it 'should use -deprecation argument when deprecation is true' do
187
+ compile_task.using(:deprecation=>true)
188
+ javac_args.should include('-deprecation')
189
+ end
190
+
191
+ it 'should not use -deprecation argument when deprecation is false' do
192
+ compile_task.using(:deprecation=>false)
193
+ javac_args.should_not include('-deprecation')
194
+ end
195
+
196
+ it 'should not set source option by default' do
197
+ compile_task.options.source.should be_nil
198
+ javac_args.should_not include('-source')
199
+ end
200
+
201
+ it 'should not set target option by default' do
202
+ compile_task.options.target.should be_nil
203
+ javac_args.should_not include('-target')
204
+ end
205
+
206
+ it 'should use -source nn argument if source option set' do
207
+ compile_task.using(:source=>'1.5')
208
+ javac_args.should include('-source', '1.5')
209
+ end
210
+
211
+ it 'should use -target nn argument if target option set' do
212
+ compile_task.using(:target=>'1.5')
213
+ javac_args.should include('-target', '1.5')
214
+ end
215
+
216
+ it 'should set lint option to false by default' do
217
+ compile_task.options.lint.should be_false
218
+ end
219
+
220
+ it 'should use -lint argument if lint option is true' do
221
+ compile_task.using(:lint=>true)
222
+ javac_args.should include('-Xlint')
223
+ end
224
+
225
+ it 'should use -lint argument with value of option' do
226
+ compile_task.using(:lint=>'all')
227
+ javac_args.should include('-Xlint:all')
228
+ end
229
+
230
+ it 'should use -lint argument with value of option as array' do
231
+ compile_task.using(:lint=>%w[path serial])
232
+ javac_args.should include('-Xlint:path,serial')
233
+ end
234
+
235
+ it 'should not set other option by default' do
236
+ compile_task.options.other.should be_nil
237
+ end
238
+
239
+ it 'should pass other argument if other option is string' do
240
+ compile_task.using(:other=>'-Xprint')
241
+ javac_args.should include('-Xprint')
242
+ end
243
+
244
+ it 'should pass other argument if other option is array' do
245
+ compile_task.using(:other=>%w[-Xstdout msgs])
246
+ javac_args.should include('-Xstdout', 'msgs')
247
+ end
248
+
249
+ it 'should complain about options it doesn\'t know' do
250
+ write 'source/Test.java', 'class Test {}'
251
+ compile_task.using(:unknown=>'option')
252
+ lambda { compile_task.from('source').invoke }.should raise_error(ArgumentError, /no such option/i)
253
+ end
254
+
255
+ it 'should inherit options from parent' do
256
+ define 'foo' do
257
+ compile.using(:warnings=>true, :debug=>true, :deprecation=>true, :source=>'1.5', :target=>'1.4')
258
+ define 'bar' do
259
+ compile.using(:javac)
260
+ compile.options.warnings.should be_true
261
+ compile.options.debug.should be_true
262
+ compile.options.deprecation.should be_true
263
+ compile.options.source.should eql('1.5')
264
+ compile.options.target.should eql('1.4')
265
+ end
266
+ end
267
+ end
268
+
269
+ after do
270
+ Buildr.options.debug = nil
271
+ ENV.delete "debug"
272
+ ENV.delete "DEBUG"
273
+ end
274
+ end
@@ -0,0 +1,165 @@
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
+ require File.expand_path('../spec_helpers', File.dirname(__FILE__))
17
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
18
+
19
+ describe Buildr::CustomPom do
20
+
21
+ def xml_document(filename)
22
+ File.should be_exist(filename)
23
+ REXML::Document.new(File.read(filename))
24
+ end
25
+
26
+ def project_pom_xml(project)
27
+ xml_document(project.packages[0].pom.to_s)
28
+ end
29
+
30
+ def verify_license(pom_xml, name, url)
31
+ pom_xml.should match_xpath("/project/licenses/license/url[../name/text() = '#{name}']", url)
32
+ end
33
+
34
+ def dependency_xpath(artifact_id)
35
+ "/project/dependencies/dependency[artifactId/text() = '#{artifact_id}']"
36
+ end
37
+
38
+ def verify_dependency_group(pom_xml, artifact_id, group)
39
+ pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/groupId", group)
40
+ end
41
+
42
+ def verify_dependency_version(pom_xml, artifact_id, version)
43
+ pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/version", version)
44
+ end
45
+
46
+ def verify_dependency_scope(pom_xml, artifact_id, scope)
47
+ pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/scope", scope)
48
+ end
49
+
50
+ def verify_dependency_optional(pom_xml, artifact_id, optional)
51
+ pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/optional", optional)
52
+ end
53
+
54
+ def verify_dependency(pom_xml, artifact_id, group, version, scope, optional)
55
+ verify_dependency_group(pom_xml, artifact_id, group)
56
+ verify_dependency_version(pom_xml, artifact_id, version)
57
+ verify_dependency_scope(pom_xml, artifact_id, scope)
58
+ verify_dependency_optional(pom_xml, artifact_id, optional)
59
+ pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/exclusions/exclusion/groupId", '*')
60
+ pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/exclusions/exclusion/artifactId", '*')
61
+ end
62
+
63
+ describe 'with explicitly specified pom details' do
64
+ before do
65
+ %w(id-provided id-optional id-runtime id-test).each do |artifact_id|
66
+ artifact("group:#{artifact_id}:jar:1.0") do |t|
67
+ mkdir_p File.dirname(t.to_s)
68
+ Zip::OutputStream.open t.to_s do |zip|
69
+ zip.put_next_entry 'empty.txt'
70
+ end
71
+ end
72
+ end
73
+ write 'src/main/java/Example.java', 'public class Example {}'
74
+
75
+ @foo = define 'foo' do
76
+ project.group = 'org.myproject'
77
+ project.version = '1.0'
78
+
79
+ pom.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
80
+ pom.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
81
+ pom.scm_connection = pom.scm_developer_connection = 'scm:git:git@github.com:jbloggs/myproject'
82
+ pom.scm_url = 'git@github.com:jbloggs/myproject'
83
+ pom.url = 'https://github.com/jbloggs/myproject'
84
+ pom.issues_url = 'https://github.com/jbloggs/myproject/issues'
85
+ pom.issues_system = 'GitHub Issues'
86
+ pom.add_developer('jbloggs', 'Joe Bloggs', 'jbloggs@example.com', ['Project Lead'])
87
+ pom.provided_dependencies = ['group:id-provided:jar:1.0']
88
+ pom.optional_dependencies = ['group:id-optional:jar:1.0']
89
+
90
+ compile.with 'group:id-runtime:jar:1.0', 'group:id-optional:jar:1.0', 'group:id-provided:jar:1.0'
91
+
92
+ test.with 'group:id-test:jar:1.0'
93
+
94
+ package(:jar)
95
+ end
96
+ task('package').invoke
97
+ @pom_xml = project_pom_xml(@foo)
98
+ #$stderr.puts @pom_xml.to_s
99
+ end
100
+
101
+ it 'has correct project level metadata' do
102
+ @pom_xml.should match_xpath('/project/groupId', 'org.myproject')
103
+ @pom_xml.should match_xpath('/project/artifactId', 'foo')
104
+ @pom_xml.should match_xpath('/project/version', '1.0')
105
+ @pom_xml.should match_xpath('/project/packaging', 'jar')
106
+ @pom_xml.should match_xpath('/project/name', 'foo')
107
+ @pom_xml.should match_xpath('/project/description', 'foo')
108
+ @pom_xml.should match_xpath('/project/url', 'https://github.com/jbloggs/myproject')
109
+ end
110
+
111
+ it 'has correct scm details' do
112
+ @pom_xml.should match_xpath('/project/scm/connection', 'scm:git:git@github.com:jbloggs/myproject')
113
+ @pom_xml.should match_xpath('/project/scm/developerConnection', 'scm:git:git@github.com:jbloggs/myproject')
114
+ @pom_xml.should match_xpath('/project/scm/url', 'git@github.com:jbloggs/myproject')
115
+ end
116
+
117
+ it 'has correct issueManagement details' do
118
+ @pom_xml.should match_xpath('/project/issueManagement/url', 'https://github.com/jbloggs/myproject/issues')
119
+ @pom_xml.should match_xpath('/project/issueManagement/system', 'GitHub Issues')
120
+ end
121
+
122
+ it 'has correct developers details' do
123
+ @pom_xml.should match_xpath('/project/developers/developer/id', 'jbloggs')
124
+ @pom_xml.should match_xpath('/project/developers/developer/name', 'Joe Bloggs')
125
+ @pom_xml.should match_xpath('/project/developers/developer/email', 'jbloggs@example.com')
126
+ @pom_xml.should match_xpath('/project/developers/developer/roles/role', 'Project Lead')
127
+ end
128
+
129
+ it 'has correct license details' do
130
+ verify_license(@pom_xml, 'The Apache Software License, Version 2.0', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
131
+ verify_license(@pom_xml, 'GNU General Public License (GPL) version 3.0', 'http://www.gnu.org/licenses/gpl-3.0.html')
132
+ end
133
+
134
+ it 'has correct dependency details' do
135
+ verify_dependency(@pom_xml, 'id-runtime', 'group', '1.0', nil, nil)
136
+ verify_dependency(@pom_xml, 'id-optional', 'group', '1.0', nil, 'true')
137
+ verify_dependency(@pom_xml, 'id-provided', 'group', '1.0', 'provided', nil)
138
+ verify_dependency(@pom_xml, 'id-test', 'group', '1.0', 'test', nil)
139
+ end
140
+ end
141
+
142
+ describe 'with a multi-module project' do
143
+ before do
144
+ write 'foo/src/main/java/Foo.java', 'public class Foo {}'
145
+ write 'bar/src/main/java/Bar.java', 'public class Bar {}'
146
+ define('myproject', :group => 'group', :version => '1.0') do
147
+ define('foo') do
148
+ package(:jar)
149
+ end
150
+ define(:bar) do
151
+ compile.with project('foo')
152
+ package(:jar)
153
+ pom.description = 'BAR Project'
154
+ end
155
+ end
156
+ task('package').invoke
157
+
158
+ @pom_xml = project_pom_xml(project('myproject:bar'))
159
+ end
160
+
161
+ it 'should add foo to the dependencies of bar\'s pom.xml' do
162
+ verify_dependency(@pom_xml, 'myproject-foo', 'group', '1.0', nil, nil)
163
+ end
164
+ end
165
+ end