[GRADLE-1018] IDEA plugin should automatically add Scala facet to module Created: 05/Jul/10 Updated: 11/Mar/13 Resolved: 04/Feb/13 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 1.5-rc-1 |
Type: | Improvement | ||
Reporter: | David Rosell | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 3 |
Description |
It would be good to have the Scala Facet section automatically generated in the .iml file. When manually adding the Scala Facet, this is generated: <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="FacetManager"> <facet type="Scala" name="Scala"> <configuration> <option name="takeFromSettings" value="true" /> <option name="myScalaCompilerJarPaths"> <array> <option value="$MODULE_DIR$/../../../../Library/Application Support/IntelliJIdea90/Scala/lib/scala-compiler.jar" /> </array> </option> <option name="myScalaSdkJarPaths"> <array> <option value="$MODULE_DIR$/../../../../Library/Application Support/IntelliJIdea90/Scala/lib/scala-library.jar" /> </array> </option> </configuration> </facet> </component> <component name="NewModuleRootManager" inherit-compiler-output="false"> However, in the build file you specify scalaTools dependencies: dependencies { // Lib for scala tools scalaTools 'org.scala-lang:scala-library:2.8.0.RC6' scalaTools 'org.scala-lang:scala-compiler:2.8.0.RC6' // Lib for scala api ... } It would be good to have a simple way to add these compiler and library dependencies, so that IntelliJ uses the same libs as Gradle: <component name="FacetManager"> <facet type="Scala" name="Scala"> <configuration> <option name="takeFromSettings" value="true" /> <option name="myScalaCompilerJarPaths"> <array> <option value="$MODULE_DIR$/../../../../.gradle/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.8.0.RC6.jar" /> </array> </option> <option name="myScalaSdkJarPaths"> <array> <option value="$MODULE_DIR$/../../../../.gradle/cache/org.scala-lang/scala-library/jars/scala-library-2.8.0.RC6.jar" /> </array> </option> </configuration> </facet> </component> It is mainly the path resolution thingy that is needed, since the rest is simple xlm generation. If the components for doing this is already in place, an example in the "modify XML" part of the documentation would be great. |
Comments |
Comment by David Rosell [ 05/Jul/10 ] |
Sorry, priority ought to be minor - the workaround is to edit in the file, clunky but doable. |
Comment by Michael Franz [ 22/Dec/12 ] |
For teams using gradle and Scala, this feature is a must. |
Comment by Peter Walker (Inactive) [ 24/Dec/12 ] |
I can import this build script using Idea 12.0.1. apply plugin:'scala' def slf4j_version='1.6.4' dependencies { // Libraries needed to run the scala tools scalaTools 'org.scala-lang:scala-compiler:2.9.2' scalaTools 'org.scala-lang:scala-library:2.9.2' // Libraries needed for scala api testCompile 'org.scala-lang:scala-library:2.9.2' testCompile project(':collections-testutils') testCompile "org.slf4j:slf4j-api:${slf4j_version}" testCompile "org.slf4j:slf4j-nop:${slf4j_version}" } compileTestScala { scalaCompileOptions.useAnt = false } and it generates a facet like so: <?xml version="1.0" encoding="UTF-8"?> <module type="JAVA_MODULE" version="4"> <component name="FacetManager"> <facet type="scala" name="Scala"> <configuration> <option name="compilerLibraryLevel" value="Project" /> <option name="compilerLibraryName" value="scala-library-2.9.2" /> <option name="languageLevel" value="Scala 2.9" /> </configuration> </facet> </component> <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$/scala-unit-tests"> <sourceFolder url="file://$MODULE_DIR$/scala-unit-tests/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/scala-unit-tests/src/main/scala" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/scala-unit-tests/src/main/resources" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/scala-unit-tests/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/scala-unit-tests/src/test/scala" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/scala-unit-tests/src/test/resources" isTestSource="true" /> <excludeFolder url="file://$MODULE_DIR$/scala-unit-tests/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/scala-unit-tests/build" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="module" module-name="collections-testutils" scope="TEST" /> <orderEntry type="library" scope="TEST" name="scala-library-2.9.2" level="project" /> <orderEntry type="library" scope="TEST" name="slf4j-nop-1.6.4" level="project" /> <orderEntry type="library" scope="TEST" name="slf4j-api-1.6.4" level="project" /> </component> </module> This appeared correct in the IDE - can you highlight what still isnt working? |
Comment by Michael Franz [ 24/Dec/12 ] |
Using Gradle 1.3 in an empty project I get the following errors when running 'gradle': FAILURE: Build failed with an exception.
BUILD FAILED Where line 10 is: testCompile project(':collections-testutils') Importing as a new project into IntelliJ 11.1.4 does not create a Scala facet. My expected usage would be: |
Comment by Peter Walker (Inactive) [ 28/Dec/12 ] |
Michael, Once gradle idea is run, Idea will automatically refresh. I have a sample scala project @ https://github.com/peterwalker/scala-samples. |
Comment by Peter Walker (Inactive) [ 05/Feb/13 ] |
I have tested https://github.com/peterwalker/scala-samples with the latest nightly ( gradle-1.5-20130204201733 ) and gradle idea now generates scala facets. |