On 17/03/2011 15:32, Rhett Sutphin wrote:
I didn't realize that IDEA supported dependency scope now. That's good to know.
(Apparently[1] it was added in IDEA 9.)
To track this request, you should open an issue in buildr's JIRA. If you want
to supply a patch you attach it there. (This process is required by the ASF.) I
haven't looked at your patch, so I'm not sure if it's the right solution.
ok : my patch is attached to this email and to JIRA too : see
https://issues.apache.org/jira/browse/BUILDR-574
Also, a remark. The CLI API changed : in the past, a simple "buildr idea" was ok to generated idea files, but
now we have to do a "buildr idea:generate". This is inconsistent with the eclipse plugin (still "buildr
eclipse"), makes me think of the infamous "mvn eclipse:eclipse" (argh ! eclipse twice !) and shows
implementation details to the final user. What do you think about it ? Should I file a bug for that too ?
I agree that it should be possible to do just "buildr idea". You should open
another issue for this request.
ok: https://issues.apache.org/jira/browse/BUILDR-575
As a workaround (and this is what I've been doing), you can add an idea task at
the top level of your buildfile:
task :idea => "idea:generate"
I did the same :-)
Rhett
--
Jean-Philippe Caruana
----------------------------------------------------------------------
sorry for the crap that will be appended here:
********************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'attention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration. Multimedia Business
Services decline
toute responsabilite au titre de ce message s'il a ete altere, deforme
ou falsifie.
Si vous n'etes pas destinataire de ce message, merci de le detruire
immediatement et d'avertir l'expediteur.
*********************************
This message and any attachments (the "message") are confidential and
intended solely for the addressees. Any unauthorised use or
dissemination is prohibited.
Messages are susceptible to alteration. Multimedia Business Services shall not
be liable for the
message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it
immediately and inform the sender..
********************************
lib/buildr/ide/idea.rb | 13 +++++++------
spec/ide/idea_spec.rb | 6 +++---
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index a820d1c..3f199bf 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -192,6 +192,7 @@ module Buildr
protected
+ # Note: Use the test classpath since IDEA compiles both "main" and "test" classes using the same classpath
def test_dependency_details
main_dependencies_paths = main_dependencies.map(&:to_s)
target_dir = buildr_project.compile.target.to_s
@@ -206,7 +207,6 @@ module Buildr
end
[dependency_path, export, source_path]
end
-
end
def base_directory
@@ -246,7 +246,6 @@ module Buildr
generate_initial_order_entries(xml)
project_dependencies = []
- # Note: Use the test classpath since IDEA compiles both "main" and "test" classes using the same classpath
self.test_dependency_details.each do |dependency_path, export, source_path|
project_for_dependency = Buildr.projects.detect do |project|
[project.packages, project.compile.target, project.resources.target, project.test.compile.target, project.test.resources.target].flatten.
@@ -254,12 +253,12 @@ module Buildr
end
if project_for_dependency
if project_for_dependency.iml? && !project_dependencies.include?(project_for_dependency)
- generate_project_dependency(xml, project_for_dependency.iml.name, export)
+ generate_project_dependency(xml, project_for_dependency.iml.name, export, !export)
end
project_dependencies << project_for_dependency
next
else
- generate_module_lib(xml, url_for_path(dependency_path), export, (source_path ? url_for_path(source_path) : nil))
+ generate_module_lib(xml, url_for_path(dependency_path), export, (source_path ? url_for_path(source_path) : nil), !export)
end
end
@@ -338,15 +337,17 @@ module Buildr
xml.orderEntry :type => "inheritedJdk"
end
- def generate_project_dependency(xml, other_project, export = true)
+ def generate_project_dependency(xml, other_project, export, test = false)
attribs = {:type => 'module', "module-name" => other_project}
attribs[:exported] = '' if export
+ attribs[:scope] = 'TEST' if test
xml.orderEntry attribs
end
- def generate_module_lib(xml, path, export, source_path)
+ def generate_module_lib(xml, path, export, source_path, test = false)
attribs = {:type => 'module-library'}
attribs[:exported] = '' if export
+ attribs[:scope] = 'TEST' if test
xml.orderEntry attribs do
xml.library do
xml.CLASSES do
diff --git a/spec/ide/idea_spec.rb b/spec/ide/idea_spec.rb
index fc170c5..7fda776 100644
--- a/spec/ide/idea_spec.rb
+++ b/spec/ide/idea_spec.rb
@@ -141,9 +141,9 @@ describe Buildr::IntellijIdea do
invoke_generate_task
end
- it "generates one non-exported 'module-library' orderEntry in IML" do
+ it "generates one non-exported test scope 'module-library' orderEntry in IML" do
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
- root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root", 1)
+ root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @scope='TEST']/library/CLASSES/root", 1)
end
end
@@ -1142,4 +1142,4 @@ PROJECT_XML
end
end
-end
\ No newline at end of file
+end