You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2017/02/14 06:52:12 UTC

buildr git commit: BUILDR-729 Integrate into core and just make it the default pom generated.

Repository: buildr
Updated Branches:
  refs/heads/master 5ba7e9a50 -> 14116ad04


BUILDR-729 Integrate  into core and just make it the default pom generated.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/14116ad0
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/14116ad0
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/14116ad0

Branch: refs/heads/master
Commit: 14116ad04aa02baddc990b6440f948f50396c51d
Parents: 5ba7e9a
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Mon Feb 6 22:14:13 2017 -0800
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Mon Feb 13 22:52:06 2017 -0800

----------------------------------------------------------------------
 CHANGELOG                     |   1 +
 addon/buildr/custom_pom.rb    | 275 +----------------------------------
 lib/buildr.rb                 |   1 +
 lib/buildr/java/custom_pom.rb | 287 +++++++++++++++++++++++++++++++++++++
 spec/addon/custom_pom_spec.rb | 185 ------------------------
 spec/java/custom_pom_spec.rb  | 185 ++++++++++++++++++++++++
 6 files changed, 477 insertions(+), 457 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/14116ad0/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index ec9cef6..84a70ef 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@
 * Change: BUILDR-724 Use scalamain to call scala projects
 * Change: BUILDR-719 Change User-Agent when uploading artifacts
 * Change: Set the OPEN_IN_BROWSER to false when building idea launch targets via add_glassfish_remote_configuration.
+* Change: BUILDR-709 Integrate `buildr/custom_pom` into core and just make it the default pom generated.
 
 1.5.0 (2016-09-23)
 * Change: Update RJB to 1.5.4

http://git-wip-us.apache.org/repos/asf/buildr/blob/14116ad0/addon/buildr/custom_pom.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/custom_pom.rb b/addon/buildr/custom_pom.rb
index b60f5ee..885bfb8 100644
--- a/addon/buildr/custom_pom.rb
+++ b/addon/buildr/custom_pom.rb
@@ -13,275 +13,6 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-module Buildr
-  class CustomPom
-    Developer = Struct.new(:id, :name, :email, :roles)
-
-    # Specify the name of the project
-    attr_writer :name
-
-    # Retrieve the name of the project, defaulting to the project description or the name if not specified
-    def name
-      @name || @buildr_project.comment || @buildr_project.name
-    end
-
-    # Specify a project description
-    attr_writer :description
-
-    # Retrieve the project description, defaulting to the name if not specified
-    def description
-      @description || name
-    end
-
-    # Property for the projects url
-    attr_accessor :url
-
-    # Return the map of licenses for project
-    def licenses
-      @licenses ||= {}
-    end
-
-    # Add Apache2 to the list of licenses
-    def add_apache_v2_license
-      self.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-    end
-
-    def add_bsd_2_license
-      self.licenses['The BSD 2-Clause License'] = 'http://opensource.org/licenses/BSD-2-Clause'
-    end
-
-    def add_bsd_3_license
-      self.licenses['The BSD 3-Clause License'] = 'http://opensource.org/licenses/BSD-3-Clause'
-    end
-
-    def add_cddl_v1_license
-      self.licenses['Common Development and Distribution License (CDDL-1.0)'] = 'http://opensource.org/licenses/CDDL-1.0'
-    end
-
-    def add_epl_v1_license
-      self.licenses['Eclipse Public License - v 1.0'] = 'http://www.eclipse.org/legal/epl-v10.html'
-    end
-
-    def add_gpl_v1_license
-      self.licenses['GNU General Public License (GPL) version 1.0'] = 'http://www.gnu.org/licenses/gpl-1.0.html'
-    end
-
-    def add_gpl_v2_license
-      self.licenses['GNU General Public License (GPL) version 2.0'] = 'http://www.gnu.org/licenses/gpl-2.0.html'
-    end
-
-    def add_gpl_v3_license
-      self.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
-    end
-
-    def add_lgpl_v2_license
-      self.licenses['GNU General Lesser Public License (LGPL) version 2.1'] = 'http://www.gnu.org/licenses/lgpl-2.1.html'
-    end
-
-    def add_lgpl_v3_license
-      self.licenses['GNU General Lesser Public License (LGPL) version 3.0'] = 'http://www.gnu.org/licenses/lgpl-3.0.html'
-    end
-
-    def add_mit_license
-      self.licenses['The MIT License'] = 'http://opensource.org/licenses/MIT'
-    end
-
-    attr_accessor :scm_url
-    attr_accessor :scm_connection
-    attr_accessor :scm_developer_connection
-
-    attr_accessor :issues_url
-    attr_accessor :issues_system
-
-    # Add a project like add_github_project('realityforge/gwt-appcache')
-    def add_github_project(project_spec)
-      git_url = "git@github.com:#{project_spec}.git"
-      self.scm_connection = self.scm_developer_connection = "scm:git:#{git_url}"
-      self.scm_url = git_url
-      web_url = "https://github.com/#{project_spec}"
-      self.url = web_url
-      self.issues_url = "#{web_url}/issues"
-      self.issues_system = 'GitHub Issues'
-    end
-
-    def developers
-      @developers ||= []
-    end
-
-    def add_developer(id, name = nil, email = nil, roles = nil)
-      self.developers << Developer.new(id, name, email, roles)
-    end
-
-    def provided_dependencies
-      @provided_dependencies ||= []
-    end
-
-    def provided_dependencies=(provided_dependencies)
-      @provided_dependencies = provided_dependencies
-    end
-
-    def runtime_dependencies
-      @runtime_dependencies ||= []
-    end
-
-    def runtime_dependencies=(runtime_dependencies)
-      @runtime_dependencies = runtime_dependencies
-    end
-
-    def optional_dependencies
-      @optional_dependencies ||= []
-    end
-
-    def optional_dependencies=(optional_dependencies)
-      @optional_dependencies = optional_dependencies
-    end
-
-    protected
-
-    def associate_project(buildr_project)
-      @buildr_project = buildr_project
-    end
-
-    def self.pom_xml(project, package)
-      Proc.new do
-        xml = Builder::XmlMarkup.new(:indent => 2)
-        xml.instruct!
-        xml.project('xmlns' => 'http://maven.apache.org/POM/4.0.0',
-                    'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
-                    'xsi:schemaLocation' => 'http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd') do
-          xml.modelVersion '4.0.0'
-          xml.parent do
-            xml.groupId 'org.sonatype.oss'
-            xml.artifactId 'oss-parent'
-            xml.version '7'
-          end
-          xml.groupId project.group
-          xml.artifactId project.id
-          xml.version project.version
-          xml.packaging package.type.to_s
-          xml.classifier package.classifier if package.classifier
-
-          xml.name project.pom.name if project.pom.name
-          xml.description project.pom.description if project.pom.description
-          xml.url project.pom.url if project.pom.url
-
-          xml.licenses do
-            project.pom.licenses.each_pair do |name, url|
-              xml.license do
-                xml.name name
-                xml.url url
-                xml.distribution 'repo'
-              end
-            end
-          end
-
-          if project.pom.scm_url || project.pom.scm_connection || project.pom.scm_developer_connection
-            xml.scm do
-              xml.connection project.pom.scm_connection if project.pom.scm_connection
-              xml.developerConnection project.pom.scm_developer_connection if project.pom.scm_developer_connection
-              xml.url project.pom.scm_url if project.pom.scm_url
-            end
-          end
-
-          if project.pom.issues_url
-            xml.issueManagement do
-              xml.url project.pom.issues_url
-              xml.system project.pom.issues_system if project.pom.issues_system
-            end
-          end
-
-          xml.developers do
-            project.pom.developers.each do |developer|
-              xml.developer do
-                xml.id developer.id
-                xml.name developer.name if developer.name
-                xml.email developer.email if developer.email
-                if developer.roles
-                  xml.roles do
-                    developer.roles.each do |role|
-                      xml.role role
-                    end
-                  end
-                end
-              end
-            end
-          end
-
-          xml.dependencies do
-            provided_deps = Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
-            runtime_deps = Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
-            optional_deps = Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
-            deps =
-              Buildr.artifacts(project.compile.dependencies).
-                select { |d| d.is_a?(ActsAsArtifact) }.
-                collect do |d|
-                f = d.to_s
-                scope = provided_deps.include?(f) ? 'provided' :
-                  runtime_deps.include?(f) ? 'runtime' :
-                    'compile'
-                d.to_hash.merge(:scope => scope, :optional => optional_deps.include?(f))
-              end + Buildr.artifacts(project.test.compile.dependencies).
-                select { |d| d.is_a?(ActsAsArtifact) && !project.compile.dependencies.include?(d) }.collect { |d| d.to_hash.merge(:scope => 'test') }
-            deps.each do |dependency|
-              xml.dependency do
-                xml.groupId dependency[:group]
-                xml.artifactId dependency[:id]
-                xml.version dependency[:version]
-                xml.scope dependency[:scope] unless dependency[:scope] == 'compile'
-                xml.optional true if dependency[:optional]
-                xml.exclusions do
-                  xml.exclusion do
-                    xml.groupId '*'
-                    xml.artifactId '*'
-                  end
-                end
-              end
-            end
-          end
-        end
-      end
-    end
-  end
-  module CPom
-    module ProjectExtension
-      include Extension
-
-      def pom
-        unless @pom
-          @pom = parent ? parent.pom.dup : Buildr::CustomPom.new
-          @pom.send :associate_project, self
-        end
-        @pom
-      end
-
-      after_define do |project|
-        project.packages.each do |pkg|
-          if pkg.type.to_s == 'jar' && pkg.classifier.nil?
-            class << pkg
-              def pom_xml
-                self.pom.content
-              end
-
-              def pom
-                unless @pom
-                  pom_filename = Util.replace_extension(name, 'pom')
-                  spec = {:group => group, :id => id, :version => version, :type => :pom}
-                  @pom = Buildr.artifact(spec, pom_filename)
-                  buildr_project = Buildr.project(self.scope.join(':'))
-                  @pom.content Buildr::CustomPom.pom_xml(buildr_project, self)
-                end
-                @pom
-              end
-            end
-            pkg.instance_variable_set('@pom', nil)
-            pkg.enhance([pkg.pom.to_s])
-          end
-        end
-      end
-    end
-  end
-end
-
-class Buildr::Project
-  include Buildr::CPom::ProjectExtension
-end
+msg = "This extension is now included as part of the core Buildr library"
+raise msg if (Buildr::VERSION >= "1.6")
+warn(msg)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/buildr/blob/14116ad0/lib/buildr.rb
----------------------------------------------------------------------
diff --git a/lib/buildr.rb b/lib/buildr.rb
index 2bd5875..a5dbcd2 100644
--- a/lib/buildr.rb
+++ b/lib/buildr.rb
@@ -84,6 +84,7 @@ require 'buildr/java/packaging'
 require 'buildr/java/commands'
 require 'buildr/java/doc'
 require 'buildr/java/deprecated'
+require 'buildr/java/custom_pom'
 require 'buildr/ide/idea'
 require 'buildr/ide/eclipse'
 

http://git-wip-us.apache.org/repos/asf/buildr/blob/14116ad0/lib/buildr/java/custom_pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/custom_pom.rb b/lib/buildr/java/custom_pom.rb
new file mode 100644
index 0000000..739d95a
--- /dev/null
+++ b/lib/buildr/java/custom_pom.rb
@@ -0,0 +1,287 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+module Buildr
+  class CustomPom
+    Developer = Struct.new(:id, :name, :email, :roles)
+
+    # Specify the name of the project
+    attr_writer :name
+
+    # Retrieve the name of the project, defaulting to the project description or the name if not specified
+    def name
+      @name || @buildr_project.comment || @buildr_project.name
+    end
+
+    # Specify a project description
+    attr_writer :description
+
+    # Retrieve the project description, defaulting to the name if not specified
+    def description
+      @description || name
+    end
+
+    # Property for the projects url
+    attr_accessor :url
+
+    # Return the map of licenses for project
+    def licenses
+      @licenses ||= {}
+    end
+
+    # Add Apache2 to the list of licenses
+    def add_apache_v2_license
+      self.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+    end
+
+    def add_bsd_2_license
+      self.licenses['The BSD 2-Clause License'] = 'http://opensource.org/licenses/BSD-2-Clause'
+    end
+
+    def add_bsd_3_license
+      self.licenses['The BSD 3-Clause License'] = 'http://opensource.org/licenses/BSD-3-Clause'
+    end
+
+    def add_cddl_v1_license
+      self.licenses['Common Development and Distribution License (CDDL-1.0)'] = 'http://opensource.org/licenses/CDDL-1.0'
+    end
+
+    def add_epl_v1_license
+      self.licenses['Eclipse Public License - v 1.0'] = 'http://www.eclipse.org/legal/epl-v10.html'
+    end
+
+    def add_gpl_v1_license
+      self.licenses['GNU General Public License (GPL) version 1.0'] = 'http://www.gnu.org/licenses/gpl-1.0.html'
+    end
+
+    def add_gpl_v2_license
+      self.licenses['GNU General Public License (GPL) version 2.0'] = 'http://www.gnu.org/licenses/gpl-2.0.html'
+    end
+
+    def add_gpl_v3_license
+      self.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
+    end
+
+    def add_lgpl_v2_license
+      self.licenses['GNU General Lesser Public License (LGPL) version 2.1'] = 'http://www.gnu.org/licenses/lgpl-2.1.html'
+    end
+
+    def add_lgpl_v3_license
+      self.licenses['GNU General Lesser Public License (LGPL) version 3.0'] = 'http://www.gnu.org/licenses/lgpl-3.0.html'
+    end
+
+    def add_mit_license
+      self.licenses['The MIT License'] = 'http://opensource.org/licenses/MIT'
+    end
+
+    attr_accessor :scm_url
+    attr_accessor :scm_connection
+    attr_accessor :scm_developer_connection
+
+    attr_accessor :issues_url
+    attr_accessor :issues_system
+
+    # Add a project like add_github_project('realityforge/gwt-appcache')
+    def add_github_project(project_spec)
+      git_url = "git@github.com:#{project_spec}.git"
+      self.scm_connection = self.scm_developer_connection = "scm:git:#{git_url}"
+      self.scm_url = git_url
+      web_url = "https://github.com/#{project_spec}"
+      self.url = web_url
+      self.issues_url = "#{web_url}/issues"
+      self.issues_system = 'GitHub Issues'
+    end
+
+    def developers
+      @developers ||= []
+    end
+
+    def add_developer(id, name = nil, email = nil, roles = nil)
+      self.developers << Developer.new(id, name, email, roles)
+    end
+
+    def provided_dependencies
+      @provided_dependencies ||= []
+    end
+
+    def provided_dependencies=(provided_dependencies)
+      @provided_dependencies = provided_dependencies
+    end
+
+    def runtime_dependencies
+      @runtime_dependencies ||= []
+    end
+
+    def runtime_dependencies=(runtime_dependencies)
+      @runtime_dependencies = runtime_dependencies
+    end
+
+    def optional_dependencies
+      @optional_dependencies ||= []
+    end
+
+    def optional_dependencies=(optional_dependencies)
+      @optional_dependencies = optional_dependencies
+    end
+
+    protected
+
+    def associate_project(buildr_project)
+      @buildr_project = buildr_project
+    end
+
+    def self.pom_xml(project, package)
+      Proc.new do
+        xml = Builder::XmlMarkup.new(:indent => 2)
+        xml.instruct!
+        xml.project('xmlns' => 'http://maven.apache.org/POM/4.0.0',
+                    'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
+                    'xsi:schemaLocation' => 'http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd') do
+          xml.modelVersion '4.0.0'
+          xml.parent do
+            xml.groupId 'org.sonatype.oss'
+            xml.artifactId 'oss-parent'
+            xml.version '7'
+          end
+          xml.groupId project.group
+          xml.artifactId project.id
+          xml.version project.version
+          xml.packaging package.type.to_s
+          xml.classifier package.classifier if package.classifier
+
+          xml.name project.pom.name if project.pom.name
+          xml.description project.pom.description if project.pom.description
+          xml.url project.pom.url if project.pom.url
+
+          xml.licenses do
+            project.pom.licenses.each_pair do |name, url|
+              xml.license do
+                xml.name name
+                xml.url url
+                xml.distribution 'repo'
+              end
+            end
+          end
+
+          if project.pom.scm_url || project.pom.scm_connection || project.pom.scm_developer_connection
+            xml.scm do
+              xml.connection project.pom.scm_connection if project.pom.scm_connection
+              xml.developerConnection project.pom.scm_developer_connection if project.pom.scm_developer_connection
+              xml.url project.pom.scm_url if project.pom.scm_url
+            end
+          end
+
+          if project.pom.issues_url
+            xml.issueManagement do
+              xml.url project.pom.issues_url
+              xml.system project.pom.issues_system if project.pom.issues_system
+            end
+          end
+
+          xml.developers do
+            project.pom.developers.each do |developer|
+              xml.developer do
+                xml.id developer.id
+                xml.name developer.name if developer.name
+                xml.email developer.email if developer.email
+                if developer.roles
+                  xml.roles do
+                    developer.roles.each do |role|
+                      xml.role role
+                    end
+                  end
+                end
+              end
+            end
+          end
+
+          xml.dependencies do
+            provided_deps = Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
+            runtime_deps = Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
+            optional_deps = Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
+            deps =
+              Buildr.artifacts(project.compile.dependencies).
+                select { |d| d.is_a?(ActsAsArtifact) }.
+                collect do |d|
+                f = d.to_s
+                scope = provided_deps.include?(f) ? 'provided' :
+                  runtime_deps.include?(f) ? 'runtime' :
+                    'compile'
+                d.to_hash.merge(:scope => scope, :optional => optional_deps.include?(f))
+              end + Buildr.artifacts(project.test.compile.dependencies).
+                select { |d| d.is_a?(ActsAsArtifact) && !project.compile.dependencies.include?(d) }.collect { |d| d.to_hash.merge(:scope => 'test') }
+            deps.each do |dependency|
+              xml.dependency do
+                xml.groupId dependency[:group]
+                xml.artifactId dependency[:id]
+                xml.version dependency[:version]
+                xml.scope dependency[:scope] unless dependency[:scope] == 'compile'
+                xml.optional true if dependency[:optional]
+                xml.exclusions do
+                  xml.exclusion do
+                    xml.groupId '*'
+                    xml.artifactId '*'
+                  end
+                end
+              end
+            end
+          end
+        end
+      end
+    end
+  end
+  module CPom
+    module ProjectExtension
+      include Extension
+
+      def pom
+        unless @pom
+          @pom = parent ? parent.pom.dup : Buildr::CustomPom.new
+          @pom.send :associate_project, self
+        end
+        @pom
+      end
+
+      after_define do |project|
+        project.packages.select { |pkg| pkg.is_a?(ActsAsArtifact) }.each do |pkg|
+          if pkg.type.to_s == 'jar' && pkg.classifier.nil?
+            class << pkg
+              def pom_xml
+                self.pom.content
+              end
+
+              def pom
+                unless @pom
+                  pom_filename = Util.replace_extension(name, 'pom')
+                  spec = {:group => group, :id => id, :version => version, :type => :pom}
+                  @pom = Buildr.artifact(spec, pom_filename)
+                  buildr_project = Buildr.project(self.scope.join(':'))
+                  @pom.content Buildr::CustomPom.pom_xml(buildr_project, self)
+                end
+                @pom
+              end
+            end
+            pkg.instance_variable_set('@pom', nil)
+            pkg.enhance([pkg.pom.to_s])
+          end
+        end
+      end
+    end
+  end
+end
+
+class Buildr::Project
+  include Buildr::CPom::ProjectExtension
+end

http://git-wip-us.apache.org/repos/asf/buildr/blob/14116ad0/spec/addon/custom_pom_spec.rb
----------------------------------------------------------------------
diff --git a/spec/addon/custom_pom_spec.rb b/spec/addon/custom_pom_spec.rb
deleted file mode 100644
index 25e2cf5..0000000
--- a/spec/addon/custom_pom_spec.rb
+++ /dev/null
@@ -1,185 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-# The testing framework does not support loading and then unloading of addons
-# thus we can not test this addon until we figure out a mechanism of supporting
-# unloading addon as the test progresses
-if false
-
-require File.expand_path('../spec_helpers', File.dirname(__FILE__))
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
-
-# Next line should work but does not
-#Sandbox.require_optional_extension 'buildr/custom_pom'
-
-# Next line should not be used but is required
-require 'buildr/custom_pom'
-
-describe Buildr::CustomPom do
-
-  def xml_document(filename)
-    File.should be_exist(filename)
-    REXML::Document.new(File.read(filename))
-  end
-
-  def project_pom_xml(project)
-    xml_document(project.packages[0].pom.to_s)
-  end
-
-  def verify_license(pom_xml, name, url)
-    pom_xml.should match_xpath("/project/licenses/license/url[../name/text() = '#{name}']", url)
-  end
-
-  def dependency_xpath(artifact_id)
-    "/project/dependencies/dependency[artifactId/text() = '#{artifact_id}']"
-  end
-
-  def verify_dependency_group(pom_xml, artifact_id, group)
-    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/groupId", group)
-  end
-
-  def verify_dependency_version(pom_xml, artifact_id, version)
-    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/version", version)
-  end
-
-  def verify_dependency_scope(pom_xml, artifact_id, scope)
-    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/scope", scope)
-  end
-
-  def verify_dependency_optional(pom_xml, artifact_id, optional)
-    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/optional", optional)
-  end
-
-  def verify_dependency(pom_xml, artifact_id, group, version, scope, optional)
-    verify_dependency_group(pom_xml, artifact_id, group)
-    verify_dependency_version(pom_xml, artifact_id, version)
-    verify_dependency_scope(pom_xml, artifact_id, scope)
-    verify_dependency_optional(pom_xml, artifact_id, optional)
-    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/exclusions/exclusion/groupId", '*')
-    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/exclusions/exclusion/artifactId", '*')
-  end
-
-  describe 'with explicitly specified pom details' do
-    before do
-      %w(id-provided id-optional id-runtime id-test).each do |artifact_id|
-        artifact("group:#{artifact_id}:jar:1.0") do |t|
-          mkdir_p File.dirname(t.to_s)
-          Zip::OutputStream.open t.to_s do |zip|
-            zip.put_next_entry 'empty.txt'
-          end
-        end
-      end
-      write 'src/main/java/Example.java', 'public class Example {}'
-
-      @foo = define 'foo' do
-        project.group = 'org.myproject'
-        project.version = '1.0'
-
-        pom.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-        pom.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
-        pom.scm_connection = pom.scm_developer_connection = 'scm:git:git@github.com:jbloggs/myproject'
-        pom.scm_url = 'git@github.com:jbloggs/myproject'
-        pom.url = 'https://github.com/jbloggs/myproject'
-        pom.issues_url = 'https://github.com/jbloggs/myproject/issues'
-        pom.issues_system = 'GitHub Issues'
-        pom.add_developer('jbloggs', 'Joe Bloggs', 'jbloggs@example.com', ['Project Lead'])
-        pom.provided_dependencies = ['group:id-provided:jar:1.0']
-        pom.optional_dependencies = ['group:id-optional:jar:1.0']
-
-        compile.with 'group:id-runtime:jar:1.0', 'group:id-optional:jar:1.0', 'group:id-provided:jar:1.0'
-
-        test.with 'group:id-test:jar:1.0'
-
-        package(:jar)
-      end
-      task('package').invoke
-      @pom_xml = project_pom_xml(@foo)
-      #$stderr.puts @pom_xml.to_s
-    end
-
-    it 'has correct static metadata' do
-      @pom_xml.should match_xpath('/project/modelVersion', '4.0.0')
-      @pom_xml.should match_xpath('/project/parent/groupId', 'org.sonatype.oss')
-      @pom_xml.should match_xpath('/project/parent/artifactId', 'oss-parent')
-      @pom_xml.should match_xpath('/project/parent/version', '7')
-    end
-
-    it 'has correct project level metadata' do
-      @pom_xml.should match_xpath('/project/groupId', 'org.myproject')
-      @pom_xml.should match_xpath('/project/artifactId', 'foo')
-      @pom_xml.should match_xpath('/project/version', '1.0')
-      @pom_xml.should match_xpath('/project/packaging', 'jar')
-      @pom_xml.should match_xpath('/project/name', 'foo')
-      @pom_xml.should match_xpath('/project/description', 'foo')
-      @pom_xml.should match_xpath('/project/url', 'https://github.com/jbloggs/myproject')
-    end
-
-    it 'has correct scm details' do
-      @pom_xml.should match_xpath('/project/scm/connection', 'scm:git:git@github.com:jbloggs/myproject')
-      @pom_xml.should match_xpath('/project/scm/developerConnection', 'scm:git:git@github.com:jbloggs/myproject')
-      @pom_xml.should match_xpath('/project/scm/url', 'git@github.com:jbloggs/myproject')
-    end
-
-    it 'has correct issueManagement details' do
-      @pom_xml.should match_xpath('/project/issueManagement/url', 'https://github.com/jbloggs/myproject/issues')
-      @pom_xml.should match_xpath('/project/issueManagement/system', 'GitHub Issues')
-    end
-
-    it 'has correct developers details' do
-      @pom_xml.should match_xpath('/project/developers/developer/id', 'jbloggs')
-      @pom_xml.should match_xpath('/project/developers/developer/name', 'Joe Bloggs')
-      @pom_xml.should match_xpath('/project/developers/developer/email', 'jbloggs@example.com')
-      @pom_xml.should match_xpath('/project/developers/developer/roles/role', 'Project Lead')
-    end
-
-    it 'has correct license details' do
-      verify_license(@pom_xml, 'The Apache Software License, Version 2.0', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
-      verify_license(@pom_xml, 'GNU General Public License (GPL) version 3.0', 'http://www.gnu.org/licenses/gpl-3.0.html')
-    end
-
-    it 'has correct dependency details' do
-      verify_dependency(@pom_xml, 'id-runtime', 'group', '1.0', nil, nil)
-      verify_dependency(@pom_xml, 'id-optional', 'group', '1.0', nil, 'true')
-      verify_dependency(@pom_xml, 'id-provided', 'group', '1.0', 'provided', nil)
-      verify_dependency(@pom_xml, 'id-test', 'group', '1.0', 'test', nil)
-    end
-  end
-  
-  describe 'with a multi-module project' do
-    before do
-      write 'foo/src/main/java/Foo.java', 'public class Foo {}'
-      write 'bar/src/main/java/Bar.java', 'public class Bar {}'
-      define('myproject', :group => 'group', :version => '1.0') do
-        define('foo') do
-          package(:jar)
-        end
-        define(:bar) do
-          compile.with project('foo')
-          package(:jar)
-          pom.description = 'BAR Project'
-        end
-      end
-      task('package').invoke
-      
-      @pom_xml = project_pom_xml(project('myproject:bar'))
-    end
-    
-    it 'should add foo to the dependencies of bar\'s pom.xml' do
-      verify_dependency(@pom_xml, 'myproject-foo', 'group', '1.0', nil, nil)
-    end
-  end
-end
-
-end

http://git-wip-us.apache.org/repos/asf/buildr/blob/14116ad0/spec/java/custom_pom_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/custom_pom_spec.rb b/spec/java/custom_pom_spec.rb
new file mode 100644
index 0000000..25e2cf5
--- /dev/null
+++ b/spec/java/custom_pom_spec.rb
@@ -0,0 +1,185 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+# The testing framework does not support loading and then unloading of addons
+# thus we can not test this addon until we figure out a mechanism of supporting
+# unloading addon as the test progresses
+if false
+
+require File.expand_path('../spec_helpers', File.dirname(__FILE__))
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
+
+# Next line should work but does not
+#Sandbox.require_optional_extension 'buildr/custom_pom'
+
+# Next line should not be used but is required
+require 'buildr/custom_pom'
+
+describe Buildr::CustomPom do
+
+  def xml_document(filename)
+    File.should be_exist(filename)
+    REXML::Document.new(File.read(filename))
+  end
+
+  def project_pom_xml(project)
+    xml_document(project.packages[0].pom.to_s)
+  end
+
+  def verify_license(pom_xml, name, url)
+    pom_xml.should match_xpath("/project/licenses/license/url[../name/text() = '#{name}']", url)
+  end
+
+  def dependency_xpath(artifact_id)
+    "/project/dependencies/dependency[artifactId/text() = '#{artifact_id}']"
+  end
+
+  def verify_dependency_group(pom_xml, artifact_id, group)
+    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/groupId", group)
+  end
+
+  def verify_dependency_version(pom_xml, artifact_id, version)
+    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/version", version)
+  end
+
+  def verify_dependency_scope(pom_xml, artifact_id, scope)
+    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/scope", scope)
+  end
+
+  def verify_dependency_optional(pom_xml, artifact_id, optional)
+    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/optional", optional)
+  end
+
+  def verify_dependency(pom_xml, artifact_id, group, version, scope, optional)
+    verify_dependency_group(pom_xml, artifact_id, group)
+    verify_dependency_version(pom_xml, artifact_id, version)
+    verify_dependency_scope(pom_xml, artifact_id, scope)
+    verify_dependency_optional(pom_xml, artifact_id, optional)
+    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/exclusions/exclusion/groupId", '*')
+    pom_xml.should match_xpath("#{dependency_xpath(artifact_id)}/exclusions/exclusion/artifactId", '*')
+  end
+
+  describe 'with explicitly specified pom details' do
+    before do
+      %w(id-provided id-optional id-runtime id-test).each do |artifact_id|
+        artifact("group:#{artifact_id}:jar:1.0") do |t|
+          mkdir_p File.dirname(t.to_s)
+          Zip::OutputStream.open t.to_s do |zip|
+            zip.put_next_entry 'empty.txt'
+          end
+        end
+      end
+      write 'src/main/java/Example.java', 'public class Example {}'
+
+      @foo = define 'foo' do
+        project.group = 'org.myproject'
+        project.version = '1.0'
+
+        pom.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+        pom.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
+        pom.scm_connection = pom.scm_developer_connection = 'scm:git:git@github.com:jbloggs/myproject'
+        pom.scm_url = 'git@github.com:jbloggs/myproject'
+        pom.url = 'https://github.com/jbloggs/myproject'
+        pom.issues_url = 'https://github.com/jbloggs/myproject/issues'
+        pom.issues_system = 'GitHub Issues'
+        pom.add_developer('jbloggs', 'Joe Bloggs', 'jbloggs@example.com', ['Project Lead'])
+        pom.provided_dependencies = ['group:id-provided:jar:1.0']
+        pom.optional_dependencies = ['group:id-optional:jar:1.0']
+
+        compile.with 'group:id-runtime:jar:1.0', 'group:id-optional:jar:1.0', 'group:id-provided:jar:1.0'
+
+        test.with 'group:id-test:jar:1.0'
+
+        package(:jar)
+      end
+      task('package').invoke
+      @pom_xml = project_pom_xml(@foo)
+      #$stderr.puts @pom_xml.to_s
+    end
+
+    it 'has correct static metadata' do
+      @pom_xml.should match_xpath('/project/modelVersion', '4.0.0')
+      @pom_xml.should match_xpath('/project/parent/groupId', 'org.sonatype.oss')
+      @pom_xml.should match_xpath('/project/parent/artifactId', 'oss-parent')
+      @pom_xml.should match_xpath('/project/parent/version', '7')
+    end
+
+    it 'has correct project level metadata' do
+      @pom_xml.should match_xpath('/project/groupId', 'org.myproject')
+      @pom_xml.should match_xpath('/project/artifactId', 'foo')
+      @pom_xml.should match_xpath('/project/version', '1.0')
+      @pom_xml.should match_xpath('/project/packaging', 'jar')
+      @pom_xml.should match_xpath('/project/name', 'foo')
+      @pom_xml.should match_xpath('/project/description', 'foo')
+      @pom_xml.should match_xpath('/project/url', 'https://github.com/jbloggs/myproject')
+    end
+
+    it 'has correct scm details' do
+      @pom_xml.should match_xpath('/project/scm/connection', 'scm:git:git@github.com:jbloggs/myproject')
+      @pom_xml.should match_xpath('/project/scm/developerConnection', 'scm:git:git@github.com:jbloggs/myproject')
+      @pom_xml.should match_xpath('/project/scm/url', 'git@github.com:jbloggs/myproject')
+    end
+
+    it 'has correct issueManagement details' do
+      @pom_xml.should match_xpath('/project/issueManagement/url', 'https://github.com/jbloggs/myproject/issues')
+      @pom_xml.should match_xpath('/project/issueManagement/system', 'GitHub Issues')
+    end
+
+    it 'has correct developers details' do
+      @pom_xml.should match_xpath('/project/developers/developer/id', 'jbloggs')
+      @pom_xml.should match_xpath('/project/developers/developer/name', 'Joe Bloggs')
+      @pom_xml.should match_xpath('/project/developers/developer/email', 'jbloggs@example.com')
+      @pom_xml.should match_xpath('/project/developers/developer/roles/role', 'Project Lead')
+    end
+
+    it 'has correct license details' do
+      verify_license(@pom_xml, 'The Apache Software License, Version 2.0', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
+      verify_license(@pom_xml, 'GNU General Public License (GPL) version 3.0', 'http://www.gnu.org/licenses/gpl-3.0.html')
+    end
+
+    it 'has correct dependency details' do
+      verify_dependency(@pom_xml, 'id-runtime', 'group', '1.0', nil, nil)
+      verify_dependency(@pom_xml, 'id-optional', 'group', '1.0', nil, 'true')
+      verify_dependency(@pom_xml, 'id-provided', 'group', '1.0', 'provided', nil)
+      verify_dependency(@pom_xml, 'id-test', 'group', '1.0', 'test', nil)
+    end
+  end
+  
+  describe 'with a multi-module project' do
+    before do
+      write 'foo/src/main/java/Foo.java', 'public class Foo {}'
+      write 'bar/src/main/java/Bar.java', 'public class Bar {}'
+      define('myproject', :group => 'group', :version => '1.0') do
+        define('foo') do
+          package(:jar)
+        end
+        define(:bar) do
+          compile.with project('foo')
+          package(:jar)
+          pom.description = 'BAR Project'
+        end
+      end
+      task('package').invoke
+      
+      @pom_xml = project_pom_xml(project('myproject:bar'))
+    end
+    
+    it 'should add foo to the dependencies of bar\'s pom.xml' do
+      verify_dependency(@pom_xml, 'myproject-foo', 'group', '1.0', nil, nil)
+    end
+  end
+end
+
+end