Add support for configuring non-template TestNG run configurations
diff --git a/CHANGELOG b/CHANGELOG
index 47c2068..8d27fca 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,8 @@
* Added: Add support for the GWT version `2.8.2-v20191108` released with the nonstandard group id.
* Added: Add the `buildr/spotbugs` addon. Spotbugs is the successor of the Findbugs project and the buildr addon
is based on the original findbugs addon.
+* Added: Add support for configuring non-template TestNG run configurations for IntelliJ IDEA projects. The
+ configurations are created via the `ipr.add_testng_configuration(...)` configuration method.
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 f05850e..9d32870 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -1176,6 +1176,34 @@
end
end
+ def add_testng_configuration(name, options = {})
+ jvm_args = options[:jvm_args] || '-ea'
+ module_name = options[:module] || ''
+ dir = options[:dir]
+
+ opts = {}
+ opts[:folderName] = options[:folderName] if options[:folderName]
+ add_configuration(name, 'TestNG', nil, false, opts) do |xml|
+ xml.module(:name => module_name)
+ xml.option(:name => 'SUITE_NAME', :value => '')
+ xml.option(:name => 'PACKAGE_NAME', :value => options[:package_name] || '')
+ xml.option(:name => 'MAIN_CLASS_NAME', :value => options[:class_name] || '')
+ xml.option(:name => 'METHOD_NAME', :value => options[:method_name] || '')
+ xml.option(:name => 'GROUP_NAME', :value => options[:group_name] || '')
+ xml.option(:name => 'TEST_OBJECT', :value => (!options[:class_name].nil? ? 'CLASS' : 'PACKAGE'))
+ xml.option(:name => 'VM_PARAMETERS', :value => jvm_args)
+ xml.option(:name => 'PARAMETERS', :value => '-configfailurepolicy continue')
+ xml.option(:name => 'WORKING_DIRECTORY', :value => dir) if dir
+ xml.option(:name => 'OUTPUT_DIRECTORY', :value => '')
+ xml.option(:name => 'PROPERTIES_FILE', :value => '')
+ xml.properties
+ xml.listeners
+ xml.method(:v => '2') do
+ xml.option(:name => 'Make', :enabled => 'true')
+ end
+ end
+ end
+
def add_default_testng_configuration(options = {})
jvm_args = options[:jvm_args] || '-ea'
dir = options[:dir] || '$PROJECT_DIR$'