Fix crash bug when generating IDEA modules
This was a long existing bug but was exacerbated by 1.5.8 release
diff --git a/CHANGELOG b/CHANGELOG
index ee0b9da..2fe7054 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,9 @@
1.5.9 (Pending)
+* Fixed: Prior to `1.5.8`, generating IntelliJ IDEA modules could generate a failure if the project included
+ a dependency defined by a `JarTask` that specified a non-nil classifier. This failure scenario is now
+ much more frequent given the changes to support external annotations that are packaged as jars. This
+ crash is now avoided by changing guard from `artifact.respond_to?(:to_spec_hash)` to
+ `artifact.is_a?(Buildr::Artifact)`.
1.5.8 (2019-07-14)
* Fixed: Changed references to `https://repo1.maven.org/maven2` to use https where possible.
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index e1038ba..6aac75f 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -483,12 +483,12 @@
export = true
source_path = nil
annotations_path = nil
- if d.respond_to?(:to_spec_hash)
+ if d.is_a?(Buildr::Artifact)
source_spec = d.to_spec_hash.merge(:classifier => 'sources')
source_path = Buildr.artifact(source_spec).to_s
source_path = nil unless File.exist?(source_path)
end
- if d.respond_to?(:to_spec_hash)
+ if d.is_a?(Buildr::Artifact)
annotations_spec = d.to_spec_hash.merge(:classifier => 'annotations')
annotations_path = Buildr.artifact(annotations_spec).to_s
annotations_path = nil unless File.exist?(annotations_path)
@@ -505,12 +505,12 @@
export = main_dependencies_paths.include?(dependency_path)
source_path = nil
annotations_path = nil
- if d.respond_to?(:to_spec_hash)
+ if d.is_a?(Buildr::Artifact)
source_spec = d.to_spec_hash.merge(:classifier => 'sources')
source_path = Buildr.artifact(source_spec).to_s
source_path = nil unless File.exist?(source_path)
end
- if d.respond_to?(:to_spec_hash)
+ if d.is_a?(Buildr::Artifact)
annotations_spec = d.to_spec_hash.merge(:classifier => 'annotations')
annotations_path = Buildr.artifact(annotations_spec).to_s
annotations_path = nil unless File.exist?(annotations_path)