Thank you!
This was exactly what I needed for my Idea project generation.
I needed to add the Scala facet to the module declaration, and use the same
scala jar's in intellij as gradle do. (As you can see im not very good at
groovy, but it works :))
dependencies {
// Lib for scala tools
scalaTools 'org.scala-lang:scala-library:2.8.0'
scalaTools 'org.scala-lang:scala-compiler:2.8.0'
}
ideaModule {
withXml { root ->
configurations.scalaTools.files.each {file ->
if (file.name.startsWith('scala-compiler')) compiler =
"${file.canonicalPath}"
if (file.name.startsWith('scala-library')) library =
"${file.canonicalPath}"
}
configuration = root.appendNode('component',['name':'FacetManager'])
.appendNode('facet',['type':'Scala',
'name':'Scala'])
.appendNode('configuration')
configuration.appendNode('option',['name':'takeFromSettings','value':'true'])
configuration.appendNode('option',['name':'myScalaCompilerJarPaths'])
.appendNode('array')
.appendNode('option',['value':compiler])
configuration.appendNode('option',['name':'myScalaSdkJarPaths'])
.appendNode('array')
.appendNode('option',['value':library])
}
}
To generate this to the .iml file:
<component name="FacetManager">
<facet type="Scala" name="Scala">
<configuration>
<option name="takeFromSettings" value="true"/>
<option name="myScalaCompilerJarPaths">
<array>
<option
value="/Users/path/.gradle/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.8.0.jar"/>
</array>
</option>
<option name="myScalaSdkJarPaths">
<array>
<option
value="/Users/path/.gradle/cache/org.scala-lang/scala-library/jars/scala-library-2.8.0.jar"/>
</array>
</option>
</configuration>
</facet>
</component>
2010/7/18 Levi Hoogenberg <[email protected]>
> Does the following script (which I tested with 0.9-preview-3) do what you
> want? (And how does it differ from your own solution? I wouldn't directly
> call it unelegant.)
>
> apply plugin: 'java'
>
> dependencies {
> compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.0'
> }
>
> task listDependencies << {
> configurations.compile.getAllDependencies(ExternalDependency).each
> {dependency ->
> configurations.compile.files(dependency).each {file ->
> println
> "${dependency.group}:${dependency.name}:${file.name.split('\\.')[-1]}
> = ${file.canonicalPath}"
> }
> }
> }
>
>
> On Sun, Jul 18, 2010 at 6:39 AM, Paul Gier <[email protected]> wrote:
>
>> I have a set of compile dependencies, and I would like to generate
>> properties that look like this:
>> group:name:type = /path/to/jar
>>
>> For example a junit dependency would give something like
>> junit:junit:jar = /home/me/.gradle/junit/junit-4.3.jar
>>
>> I'm able to get the dependency linked to the file using a combination of
>> configurations.compile.files and configurations.compile.dependencies but
>> it's not very elegant, and I can't figure out how to get the file type.
>> Is there an easy way to do this?
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>