buildr-iidea 0.0.9 → 0.0.10
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.
- data/CHANGELOG +38 -33
- data/LICENSE +203 -203
- data/NOTICE +16 -16
- data/README.rdoc +328 -328
- data/Rakefile +42 -33
- data/buildr-iidea.gemspec +25 -25
- data/lib/buildr/intellij_idea/idea_file.rb +85 -85
- data/lib/buildr/intellij_idea/idea_module.rb +255 -263
- data/lib/buildr/intellij_idea/idea_project.rb +105 -105
- data/lib/buildr/intellij_idea/project_extension.rb +108 -108
- data/lib/buildr/intellij_idea/version.rb +10 -10
- data/lib/buildr_iidea.rb +6 -6
- data/spec/buildr/intellij_idea/clean_spec.rb +37 -37
- data/spec/buildr/intellij_idea/dependency_spec.rb +115 -115
- data/spec/buildr/intellij_idea/extra_modules_spec.rb +24 -24
- data/spec/buildr/intellij_idea/facet_generation_spec.rb +36 -36
- data/spec/buildr/intellij_idea/group_spec.rb +33 -33
- data/spec/buildr/intellij_idea/idea_file_generation_spec.rb +243 -243
- data/spec/buildr/intellij_idea/inform_spec.rb +28 -28
- data/spec/buildr/intellij_idea/initial_components_spec.rb +38 -38
- data/spec/buildr/intellij_idea/module_content_generation_spec.rb +96 -96
- data/spec/buildr/intellij_idea/module_defaults.rb +15 -15
- data/spec/buildr/intellij_idea/module_property_inheritance_spec.rb +27 -27
- data/spec/buildr/intellij_idea/project_extension_spec.rb +96 -96
- data/spec/buildr/intellij_idea/template_spec.rb +233 -233
- data/spec/spec_helper.rb +79 -72
- data/spec/xpath_matchers.rb +108 -108
- metadata +15 -16
- data/spec/spec.opts +0 -1
data/NOTICE
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
= COPYRIGHT NOTICES
|
2
|
-
|
3
|
-
Copyright 2010 Peter Donald
|
4
|
-
|
5
|
-
Copyright 2010 Rhett Sutphin
|
6
|
-
|
7
|
-
Apache Buildr
|
8
|
-
Copyright 2007-2009 The Apache Software Foundation
|
9
|
-
|
10
|
-
This product includes software developed at
|
11
|
-
The Apache Software Foundation (http://www.apache.org/).
|
12
|
-
|
13
|
-
Copyright 2007 Intalio
|
14
|
-
|
15
|
-
This product includes software developed by Intalio
|
16
|
-
http://www.intalio.com
|
1
|
+
= COPYRIGHT NOTICES
|
2
|
+
|
3
|
+
Copyright 2010 Peter Donald
|
4
|
+
|
5
|
+
Copyright 2010 Rhett Sutphin
|
6
|
+
|
7
|
+
Apache Buildr
|
8
|
+
Copyright 2007-2009 The Apache Software Foundation
|
9
|
+
|
10
|
+
This product includes software developed at
|
11
|
+
The Apache Software Foundation (http://www.apache.org/).
|
12
|
+
|
13
|
+
Copyright 2007 Intalio
|
14
|
+
|
15
|
+
This product includes software developed by Intalio
|
16
|
+
http://www.intalio.com
|
data/README.rdoc
CHANGED
@@ -1,328 +1,328 @@
|
|
1
|
-
= Intellij IDEA support for buildr
|
2
|
-
|
3
|
-
This extension provides tasks to generate Intellij IDEA project files by issuing:
|
4
|
-
|
5
|
-
$ buildr iidea:generate
|
6
|
-
|
7
|
-
This task will generate an .iml file for every project (or sub-project) and a .ipr
|
8
|
-
that you can directly open for the root project.
|
9
|
-
|
10
|
-
The generated project files can be removed by issuing;
|
11
|
-
|
12
|
-
$ buildr iidea:clean
|
13
|
-
|
14
|
-
The iidea task generates the project files based on the settings of each project and
|
15
|
-
extension specific settings. The main and test source trees are added to the .iml
|
16
|
-
file for each project as are the respective resource directories. The target and report
|
17
|
-
directories are excluded from the project. If the project files exist on the file system
|
18
|
-
the extension will replace specific component sections in the xml with the generated
|
19
|
-
component configurations.
|
20
|
-
|
21
|
-
Dependencies come in two forms. Dependencies on other projects and dependencies on
|
22
|
-
external jars. Dependencies on other projects are added as module dependencies in the
|
23
|
-
.iml while jars are added as regular file dependencies. Dependencies are exported from
|
24
|
-
the .iml file if they are compile dependencies. If a artifact that matches dependency but
|
25
|
-
has a classifier of 'sources' is present then it is configured as the source for the
|
26
|
-
dependency. Note: Use "buildr artifacts:sources" to download the source for dependencies.
|
27
|
-
|
28
|
-
== Installation
|
29
|
-
|
30
|
-
The extension is packaged as a gem named "buildr-iidea", consult the ruby gems installation
|
31
|
-
steps but typically it is either
|
32
|
-
|
33
|
-
sudo gem install buildr-iidea
|
34
|
-
|
35
|
-
for MRI ruby or
|
36
|
-
|
37
|
-
jgem install buildr-iidea
|
38
|
-
|
39
|
-
for jruby.
|
40
|
-
|
41
|
-
The user then needs to add the following require into the build file:
|
42
|
-
|
43
|
-
require 'buildr_iidea'
|
44
|
-
|
45
|
-
=== Warning
|
46
|
-
|
47
|
-
The iidea task may generate project files that conflict with the files generated by the
|
48
|
-
built-in 'idea' and 'idea7x' tasks. As a result the built-in tasks would fail if ran while
|
49
|
-
the extension is present. To avoid this problem the extension removes these tasks.
|
50
|
-
|
51
|
-
== Idea Specific Directives
|
52
|
-
|
53
|
-
The extension specific settings of sub-projects inherit the parent projects settings
|
54
|
-
unless overwritten.
|
55
|
-
|
56
|
-
=== Project file naming
|
57
|
-
|
58
|
-
The extension will use the last element of the projects name when generating the .ipr
|
59
|
-
and .iml files. i.e. A project named "foo" will generate "foo.iml" and "foo.ipr" while
|
60
|
-
a project named "foo:bar" will generate "bar/bar.iml" and no ipr. (The .ipr project
|
61
|
-
files are only generated for base project). The name can be modified by setting the
|
62
|
-
"ipr.suffix" or "iml.suffix" settings which specifies the suffix appended to the
|
63
|
-
file names. The user can also override the name completely by setting "ipr.id" or "iml.id".
|
64
|
-
|
65
|
-
==== Example: Setting id
|
66
|
-
|
67
|
-
define "foo" do
|
68
|
-
ipr.id = "beep"
|
69
|
-
define "bar" do
|
70
|
-
iml.id = "baz"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
Will generate:
|
75
|
-
|
76
|
-
beep.ipr
|
77
|
-
foo.iml
|
78
|
-
bar/baz.iml
|
79
|
-
|
80
|
-
==== Example: Setting suffix
|
81
|
-
|
82
|
-
define "foo" do
|
83
|
-
ipr.suffix = "-suffix1"
|
84
|
-
iml.suffix = "-suffix2"
|
85
|
-
define "bar"
|
86
|
-
end
|
87
|
-
|
88
|
-
Will generate:
|
89
|
-
|
90
|
-
foo-suffix1.ipr
|
91
|
-
foo-suffix2.iml
|
92
|
-
bar/bar-suffix2.iml
|
93
|
-
|
94
|
-
=== Disabling project file generation
|
95
|
-
|
96
|
-
The extension will not generate an iml file for a project if the "project.no_iml" method
|
97
|
-
is invoked. Generation of ipr files can be disabled by invoking the method "project.no_ipr".
|
98
|
-
|
99
|
-
==== Example
|
100
|
-
|
101
|
-
define "foo" do
|
102
|
-
project.no_ipr
|
103
|
-
define "bar" do
|
104
|
-
project.no_iml
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
Will generate:
|
109
|
-
|
110
|
-
foo.iml
|
111
|
-
|
112
|
-
=== Disabling generation of content section in .iml file
|
113
|
-
|
114
|
-
The extension will not generate a content section in an iml file if the "iml.skip_content!" method
|
115
|
-
is invoked. This can be useful if a project is just exporting dependencies and has no associated
|
116
|
-
source code. This may also be of use in scenarios where the build is repackaging an existing jar with
|
117
|
-
more meta-data or the project is just a container for other projects.
|
118
|
-
|
119
|
-
==== Example
|
120
|
-
|
121
|
-
define "foo" do
|
122
|
-
iml.skip_content!
|
123
|
-
end
|
124
|
-
|
125
|
-
=== VCS Integration
|
126
|
-
|
127
|
-
The extension will attempt to guess the VCS type of the project by looking for a .svn
|
128
|
-
or .git directory in the base projects directory. If either of these are set it will
|
129
|
-
configure the component as appropriate. Otherwise the user will need to manually specify
|
130
|
-
the project to one of either 'Git' or 'svn' using the ipr.vcs setting.
|
131
|
-
|
132
|
-
==== Example
|
133
|
-
|
134
|
-
define "foo" do
|
135
|
-
ipr.vcs = 'Git'
|
136
|
-
end
|
137
|
-
|
138
|
-
=== Dependency generation
|
139
|
-
|
140
|
-
A file dependency that exists in the local maven 2 repository is stored in the IML file
|
141
|
-
relative to the $MAVEN_REPOSITORY$ environment variable (that defaults to ~/.m2/repository).
|
142
|
-
The user can override the environment variable by setting the "iml.local_repository_env_override"
|
143
|
-
setting. If the dependency does not exist in to maven repository or the "iml.local_repository_env_override"
|
144
|
-
setting is set to nil, then the path stored in the IML is relative to the IML file.
|
145
|
-
|
146
|
-
==== Example: Setting local_repository_env_override
|
147
|
-
|
148
|
-
define "foo" do
|
149
|
-
iml.local_repository_env_override = nil
|
150
|
-
compile.with 'group:id:jar:1.0'
|
151
|
-
end
|
152
|
-
|
153
|
-
Will generate a dependency with a path like:
|
154
|
-
|
155
|
-
jar:///home/peter/.m2/repository/group/id/1.0/id-1.0.jar!/
|
156
|
-
|
157
|
-
rather than the default
|
158
|
-
|
159
|
-
jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/
|
160
|
-
|
161
|
-
==== Example: A dependency outside the maven repository
|
162
|
-
|
163
|
-
define "foo" do
|
164
|
-
compile.with _("foos-dep.jar")
|
165
|
-
end
|
166
|
-
|
167
|
-
Will generate a dependency with a path like:
|
168
|
-
|
169
|
-
jar://$MODULE_DIR$/foo-dep.jar!/
|
170
|
-
|
171
|
-
=== Module Facets
|
172
|
-
|
173
|
-
Facets are IDEAs mechanism for adding support for languages, tools and frameworks other than
|
174
|
-
core java. A facet can be added to a project so that it can be deployed as a web application
|
175
|
-
or a hibernate application. A facet can also be used t provide support for other languages
|
176
|
-
such as ruby and scala. The extension makes it possible to generate .iml with the appropriate
|
177
|
-
facets via the "iml.add_facet" method. It should be noted that facets are NOT inherited by
|
178
|
-
sub-projects.
|
179
|
-
|
180
|
-
==== Example
|
181
|
-
|
182
|
-
This example adds the web facet to a project.
|
183
|
-
|
184
|
-
define "foo" do
|
185
|
-
iml.add_facet("Web","web") do |facet|
|
186
|
-
facet.configuration do |conf|
|
187
|
-
conf.descriptors do |desc|
|
188
|
-
desc.deploymentDescriptor :name => 'web.xml',
|
189
|
-
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
190
|
-
:optional => "false", :version => "2.4"
|
191
|
-
end
|
192
|
-
conf.webroots do |webroots|
|
193
|
-
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
=== Custom Component Sections
|
200
|
-
|
201
|
-
If the extension does not provide capability to generate configuration for a particular
|
202
|
-
IDEA plugin the user can provide their own configuration data via the "ipr.add_component"
|
203
|
-
or "iml.add_component" methods.
|
204
|
-
|
205
|
-
==== Example: Adding .ipr specific component
|
206
|
-
|
207
|
-
This example changes the compiler configuration for project.
|
208
|
-
|
209
|
-
define "foo" do
|
210
|
-
ipr.add_component("CompilerConfiguration") do |component|
|
211
|
-
component.option :name => 'DEFAULT_COMPILER', :value => 'Javac'
|
212
|
-
component.option :name => 'DEPLOY_AFTER_MAKE', :value => '0'
|
213
|
-
component.resourceExtensions do |xml|
|
214
|
-
xml.entry :name => '.+\.nonexistent'
|
215
|
-
end
|
216
|
-
component.wildcardResourceExtensions do |xml|
|
217
|
-
xml.entry :name => '?*.nonexistent'
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
==== Example: Adding .iml specific component
|
223
|
-
|
224
|
-
This example adds the web facet to a project. Note: This overrides the facets defined by
|
225
|
-
the "iml.add_facet" method.
|
226
|
-
|
227
|
-
define "foo" do
|
228
|
-
iml.add_component("FacetManager") do |component|
|
229
|
-
component.facet :type => 'web', :name => 'Web' do |facet|
|
230
|
-
facet.configuration do |conf|
|
231
|
-
conf.descriptors do |desc|
|
232
|
-
desc.deploymentDescriptor :name => 'web.xml',
|
233
|
-
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
234
|
-
:optional => "false", :version => "2.4"
|
235
|
-
end
|
236
|
-
conf.webroots do |webroots|
|
237
|
-
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
=== Templates
|
245
|
-
|
246
|
-
The underlying project files are xml the contain elements for a number of "components".
|
247
|
-
The extension will load any existing project files and replace or add any component
|
248
|
-
elements that are generated by the extension. The extension also allows the user to specify
|
249
|
-
a template with either ipr.template or iml.template settings. If a template is specified
|
250
|
-
it will be loaded and any component elements in these documents will be merged into the base
|
251
|
-
document prior to merging in generated sections. Templates are useful if you want to enforce
|
252
|
-
certain configuration options (i.e. project specific code style).
|
253
|
-
|
254
|
-
==== Example
|
255
|
-
|
256
|
-
define "foo" do
|
257
|
-
ipr.template = 'project.ipr.template'
|
258
|
-
iml.template = 'module.
|
259
|
-
end
|
260
|
-
|
261
|
-
=== Groups
|
262
|
-
|
263
|
-
IDEA provides the facility to organise modules into groups. By default the extension does not
|
264
|
-
do this but it can be enabled by iml.group setting. If that setting is set to true then the
|
265
|
-
.iml file will be placed in a group based on the parent projects name. If the setting is a string
|
266
|
-
then that is used as the name of the group.
|
267
|
-
|
268
|
-
==== Example
|
269
|
-
|
270
|
-
define "foo" do
|
271
|
-
iml.group = true
|
272
|
-
define 'bar' do
|
273
|
-
define 'baz'
|
274
|
-
end
|
275
|
-
define 'rab' do
|
276
|
-
iml.group = "MyGroup"
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
Will place the generated .imls in the following groups:
|
281
|
-
|
282
|
-
foo.iml => ''
|
283
|
-
bar/bar.iml => 'foo'
|
284
|
-
bar/baz/baz.iml => 'foo/bar'
|
285
|
-
rab/rab.iml => 'MyGroup'
|
286
|
-
|
287
|
-
=== Add Extra .iml files to .ipr
|
288
|
-
|
289
|
-
The 'ipr.extra_modules' setting makes it possible to add extra modules to the generated iml file.
|
290
|
-
The setting is an array of file names relative to the base project directory.
|
291
|
-
|
292
|
-
==== Example
|
293
|
-
|
294
|
-
define "foo" do
|
295
|
-
ipr.extra_modules << 'other.iml'
|
296
|
-
ipr.extra_modules << 'other_other.iml'
|
297
|
-
end
|
298
|
-
|
299
|
-
Will add the 'other.iml' and 'other_other.iml' files to the .ipr project files.
|
300
|
-
|
301
|
-
== Compatibility
|
302
|
-
|
303
|
-
It's been tested with IDEA 9.x.
|
304
|
-
|
305
|
-
== Future Work
|
306
|
-
|
307
|
-
The following is a list of feature requests for future versions of the extension. Feel free to
|
308
|
-
jump in and supply a patch if you have gone ahead and implemented the feature.
|
309
|
-
|
310
|
-
=== Auto-generate Web Facet
|
311
|
-
|
312
|
-
Any project that defines a war package should have a web facet auto-generated for it.
|
313
|
-
|
314
|
-
=== Auto-generate Scala Facet
|
315
|
-
|
316
|
-
Any project that contains scala source code should have a scala facet autogenerated for it.
|
317
|
-
|
318
|
-
=== Support generation of IDEA files into separate hierarchy
|
319
|
-
|
320
|
-
Add the ability for the module and project files to be generated off into a different
|
321
|
-
directory hierarchy. i.e. Generate project modules into .idea_project in projects base
|
322
|
-
directory.
|
323
|
-
|
324
|
-
=== Fix tests to work when installed as a gem
|
325
|
-
|
326
|
-
The library should determine whether it is installed as a gem and if so use the gem to
|
327
|
-
invoke the the tests. See http://rubygems.rubyforge.org/rubygems-update/Gem.html#M000228
|
328
|
-
for a possible interface to determine if currently installed as a gem.
|
1
|
+
= Intellij IDEA support for buildr
|
2
|
+
|
3
|
+
This extension provides tasks to generate Intellij IDEA project files by issuing:
|
4
|
+
|
5
|
+
$ buildr iidea:generate
|
6
|
+
|
7
|
+
This task will generate an .iml file for every project (or sub-project) and a .ipr
|
8
|
+
that you can directly open for the root project.
|
9
|
+
|
10
|
+
The generated project files can be removed by issuing;
|
11
|
+
|
12
|
+
$ buildr iidea:clean
|
13
|
+
|
14
|
+
The iidea task generates the project files based on the settings of each project and
|
15
|
+
extension specific settings. The main and test source trees are added to the .iml
|
16
|
+
file for each project as are the respective resource directories. The target and report
|
17
|
+
directories are excluded from the project. If the project files exist on the file system
|
18
|
+
the extension will replace specific component sections in the xml with the generated
|
19
|
+
component configurations.
|
20
|
+
|
21
|
+
Dependencies come in two forms. Dependencies on other projects and dependencies on
|
22
|
+
external jars. Dependencies on other projects are added as module dependencies in the
|
23
|
+
.iml while jars are added as regular file dependencies. Dependencies are exported from
|
24
|
+
the .iml file if they are compile dependencies. If a artifact that matches dependency but
|
25
|
+
has a classifier of 'sources' is present then it is configured as the source for the
|
26
|
+
dependency. Note: Use "buildr artifacts:sources" to download the source for dependencies.
|
27
|
+
|
28
|
+
== Installation
|
29
|
+
|
30
|
+
The extension is packaged as a gem named "buildr-iidea", consult the ruby gems installation
|
31
|
+
steps but typically it is either
|
32
|
+
|
33
|
+
sudo gem install buildr-iidea
|
34
|
+
|
35
|
+
for MRI ruby or
|
36
|
+
|
37
|
+
jgem install buildr-iidea
|
38
|
+
|
39
|
+
for jruby.
|
40
|
+
|
41
|
+
The user then needs to add the following require into the build file:
|
42
|
+
|
43
|
+
require 'buildr_iidea'
|
44
|
+
|
45
|
+
=== Warning
|
46
|
+
|
47
|
+
The iidea task may generate project files that conflict with the files generated by the
|
48
|
+
built-in 'idea' and 'idea7x' tasks. As a result the built-in tasks would fail if ran while
|
49
|
+
the extension is present. To avoid this problem the extension removes these tasks.
|
50
|
+
|
51
|
+
== Idea Specific Directives
|
52
|
+
|
53
|
+
The extension specific settings of sub-projects inherit the parent projects settings
|
54
|
+
unless overwritten.
|
55
|
+
|
56
|
+
=== Project file naming
|
57
|
+
|
58
|
+
The extension will use the last element of the projects name when generating the .ipr
|
59
|
+
and .iml files. i.e. A project named "foo" will generate "foo.iml" and "foo.ipr" while
|
60
|
+
a project named "foo:bar" will generate "bar/bar.iml" and no ipr. (The .ipr project
|
61
|
+
files are only generated for base project). The name can be modified by setting the
|
62
|
+
"ipr.suffix" or "iml.suffix" settings which specifies the suffix appended to the
|
63
|
+
file names. The user can also override the name completely by setting "ipr.id" or "iml.id".
|
64
|
+
|
65
|
+
==== Example: Setting id
|
66
|
+
|
67
|
+
define "foo" do
|
68
|
+
ipr.id = "beep"
|
69
|
+
define "bar" do
|
70
|
+
iml.id = "baz"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
Will generate:
|
75
|
+
|
76
|
+
beep.ipr
|
77
|
+
foo.iml
|
78
|
+
bar/baz.iml
|
79
|
+
|
80
|
+
==== Example: Setting suffix
|
81
|
+
|
82
|
+
define "foo" do
|
83
|
+
ipr.suffix = "-suffix1"
|
84
|
+
iml.suffix = "-suffix2"
|
85
|
+
define "bar"
|
86
|
+
end
|
87
|
+
|
88
|
+
Will generate:
|
89
|
+
|
90
|
+
foo-suffix1.ipr
|
91
|
+
foo-suffix2.iml
|
92
|
+
bar/bar-suffix2.iml
|
93
|
+
|
94
|
+
=== Disabling project file generation
|
95
|
+
|
96
|
+
The extension will not generate an iml file for a project if the "project.no_iml" method
|
97
|
+
is invoked. Generation of ipr files can be disabled by invoking the method "project.no_ipr".
|
98
|
+
|
99
|
+
==== Example
|
100
|
+
|
101
|
+
define "foo" do
|
102
|
+
project.no_ipr
|
103
|
+
define "bar" do
|
104
|
+
project.no_iml
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
Will generate:
|
109
|
+
|
110
|
+
foo.iml
|
111
|
+
|
112
|
+
=== Disabling generation of content section in .iml file
|
113
|
+
|
114
|
+
The extension will not generate a content section in an iml file if the "iml.skip_content!" method
|
115
|
+
is invoked. This can be useful if a project is just exporting dependencies and has no associated
|
116
|
+
source code. This may also be of use in scenarios where the build is repackaging an existing jar with
|
117
|
+
more meta-data or the project is just a container for other projects.
|
118
|
+
|
119
|
+
==== Example
|
120
|
+
|
121
|
+
define "foo" do
|
122
|
+
iml.skip_content!
|
123
|
+
end
|
124
|
+
|
125
|
+
=== VCS Integration
|
126
|
+
|
127
|
+
The extension will attempt to guess the VCS type of the project by looking for a .svn
|
128
|
+
or .git directory in the base projects directory. If either of these are set it will
|
129
|
+
configure the component as appropriate. Otherwise the user will need to manually specify
|
130
|
+
the project to one of either 'Git' or 'svn' using the ipr.vcs setting.
|
131
|
+
|
132
|
+
==== Example
|
133
|
+
|
134
|
+
define "foo" do
|
135
|
+
ipr.vcs = 'Git'
|
136
|
+
end
|
137
|
+
|
138
|
+
=== Dependency generation
|
139
|
+
|
140
|
+
A file dependency that exists in the local maven 2 repository is stored in the IML file
|
141
|
+
relative to the $MAVEN_REPOSITORY$ environment variable (that defaults to ~/.m2/repository).
|
142
|
+
The user can override the environment variable by setting the "iml.local_repository_env_override"
|
143
|
+
setting. If the dependency does not exist in to maven repository or the "iml.local_repository_env_override"
|
144
|
+
setting is set to nil, then the path stored in the IML is relative to the IML file.
|
145
|
+
|
146
|
+
==== Example: Setting local_repository_env_override
|
147
|
+
|
148
|
+
define "foo" do
|
149
|
+
iml.local_repository_env_override = nil
|
150
|
+
compile.with 'group:id:jar:1.0'
|
151
|
+
end
|
152
|
+
|
153
|
+
Will generate a dependency with a path like:
|
154
|
+
|
155
|
+
jar:///home/peter/.m2/repository/group/id/1.0/id-1.0.jar!/
|
156
|
+
|
157
|
+
rather than the default
|
158
|
+
|
159
|
+
jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/
|
160
|
+
|
161
|
+
==== Example: A dependency outside the maven repository
|
162
|
+
|
163
|
+
define "foo" do
|
164
|
+
compile.with _("foos-dep.jar")
|
165
|
+
end
|
166
|
+
|
167
|
+
Will generate a dependency with a path like:
|
168
|
+
|
169
|
+
jar://$MODULE_DIR$/foo-dep.jar!/
|
170
|
+
|
171
|
+
=== Module Facets
|
172
|
+
|
173
|
+
Facets are IDEAs mechanism for adding support for languages, tools and frameworks other than
|
174
|
+
core java. A facet can be added to a project so that it can be deployed as a web application
|
175
|
+
or a hibernate application. A facet can also be used t provide support for other languages
|
176
|
+
such as ruby and scala. The extension makes it possible to generate .iml with the appropriate
|
177
|
+
facets via the "iml.add_facet" method. It should be noted that facets are NOT inherited by
|
178
|
+
sub-projects.
|
179
|
+
|
180
|
+
==== Example
|
181
|
+
|
182
|
+
This example adds the web facet to a project.
|
183
|
+
|
184
|
+
define "foo" do
|
185
|
+
iml.add_facet("Web","web") do |facet|
|
186
|
+
facet.configuration do |conf|
|
187
|
+
conf.descriptors do |desc|
|
188
|
+
desc.deploymentDescriptor :name => 'web.xml',
|
189
|
+
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
190
|
+
:optional => "false", :version => "2.4"
|
191
|
+
end
|
192
|
+
conf.webroots do |webroots|
|
193
|
+
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
=== Custom Component Sections
|
200
|
+
|
201
|
+
If the extension does not provide capability to generate configuration for a particular
|
202
|
+
IDEA plugin the user can provide their own configuration data via the "ipr.add_component"
|
203
|
+
or "iml.add_component" methods.
|
204
|
+
|
205
|
+
==== Example: Adding .ipr specific component
|
206
|
+
|
207
|
+
This example changes the compiler configuration for project.
|
208
|
+
|
209
|
+
define "foo" do
|
210
|
+
ipr.add_component("CompilerConfiguration") do |component|
|
211
|
+
component.option :name => 'DEFAULT_COMPILER', :value => 'Javac'
|
212
|
+
component.option :name => 'DEPLOY_AFTER_MAKE', :value => '0'
|
213
|
+
component.resourceExtensions do |xml|
|
214
|
+
xml.entry :name => '.+\.nonexistent'
|
215
|
+
end
|
216
|
+
component.wildcardResourceExtensions do |xml|
|
217
|
+
xml.entry :name => '?*.nonexistent'
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
==== Example: Adding .iml specific component
|
223
|
+
|
224
|
+
This example adds the web facet to a project. Note: This overrides the facets defined by
|
225
|
+
the "iml.add_facet" method.
|
226
|
+
|
227
|
+
define "foo" do
|
228
|
+
iml.add_component("FacetManager") do |component|
|
229
|
+
component.facet :type => 'web', :name => 'Web' do |facet|
|
230
|
+
facet.configuration do |conf|
|
231
|
+
conf.descriptors do |desc|
|
232
|
+
desc.deploymentDescriptor :name => 'web.xml',
|
233
|
+
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
234
|
+
:optional => "false", :version => "2.4"
|
235
|
+
end
|
236
|
+
conf.webroots do |webroots|
|
237
|
+
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
=== Templates
|
245
|
+
|
246
|
+
The underlying project files are xml the contain elements for a number of "components".
|
247
|
+
The extension will load any existing project files and replace or add any component
|
248
|
+
elements that are generated by the extension. The extension also allows the user to specify
|
249
|
+
a template with either ipr.template or iml.template settings. If a template is specified
|
250
|
+
it will be loaded and any component elements in these documents will be merged into the base
|
251
|
+
document prior to merging in generated sections. Templates are useful if you want to enforce
|
252
|
+
certain configuration options (i.e. project specific code style).
|
253
|
+
|
254
|
+
==== Example
|
255
|
+
|
256
|
+
define "foo" do
|
257
|
+
ipr.template = 'project.ipr.template'
|
258
|
+
iml.template = 'module.iml.template'
|
259
|
+
end
|
260
|
+
|
261
|
+
=== Groups
|
262
|
+
|
263
|
+
IDEA provides the facility to organise modules into groups. By default the extension does not
|
264
|
+
do this but it can be enabled by iml.group setting. If that setting is set to true then the
|
265
|
+
.iml file will be placed in a group based on the parent projects name. If the setting is a string
|
266
|
+
then that is used as the name of the group.
|
267
|
+
|
268
|
+
==== Example
|
269
|
+
|
270
|
+
define "foo" do
|
271
|
+
iml.group = true
|
272
|
+
define 'bar' do
|
273
|
+
define 'baz'
|
274
|
+
end
|
275
|
+
define 'rab' do
|
276
|
+
iml.group = "MyGroup"
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
Will place the generated .imls in the following groups:
|
281
|
+
|
282
|
+
foo.iml => ''
|
283
|
+
bar/bar.iml => 'foo'
|
284
|
+
bar/baz/baz.iml => 'foo/bar'
|
285
|
+
rab/rab.iml => 'MyGroup'
|
286
|
+
|
287
|
+
=== Add Extra .iml files to .ipr
|
288
|
+
|
289
|
+
The 'ipr.extra_modules' setting makes it possible to add extra modules to the generated iml file.
|
290
|
+
The setting is an array of file names relative to the base project directory.
|
291
|
+
|
292
|
+
==== Example
|
293
|
+
|
294
|
+
define "foo" do
|
295
|
+
ipr.extra_modules << 'other.iml'
|
296
|
+
ipr.extra_modules << 'other_other.iml'
|
297
|
+
end
|
298
|
+
|
299
|
+
Will add the 'other.iml' and 'other_other.iml' files to the .ipr project files.
|
300
|
+
|
301
|
+
== Compatibility
|
302
|
+
|
303
|
+
It's been tested with IDEA 9.x.
|
304
|
+
|
305
|
+
== Future Work
|
306
|
+
|
307
|
+
The following is a list of feature requests for future versions of the extension. Feel free to
|
308
|
+
jump in and supply a patch if you have gone ahead and implemented the feature.
|
309
|
+
|
310
|
+
=== Auto-generate Web Facet
|
311
|
+
|
312
|
+
Any project that defines a war package should have a web facet auto-generated for it.
|
313
|
+
|
314
|
+
=== Auto-generate Scala Facet
|
315
|
+
|
316
|
+
Any project that contains scala source code should have a scala facet autogenerated for it.
|
317
|
+
|
318
|
+
=== Support generation of IDEA files into separate hierarchy
|
319
|
+
|
320
|
+
Add the ability for the module and project files to be generated off into a different
|
321
|
+
directory hierarchy. i.e. Generate project modules into .idea_project in projects base
|
322
|
+
directory.
|
323
|
+
|
324
|
+
=== Fix tests to work when installed as a gem
|
325
|
+
|
326
|
+
The library should determine whether it is installed as a gem and if so use the gem to
|
327
|
+
invoke the the tests. See http://rubygems.rubyforge.org/rubygems-update/Gem.html#M000228
|
328
|
+
for a possible interface to determine if currently installed as a gem.
|