如何使gradle / intellij / play框架一起工作? [英] How to make gradle / intellij / play framework work together?
问题描述
以下是建议的
找到答案 here 一>。显然,gradle idea插件需要被明确地告知如何连接依赖关系。
总结:
- 创建一个典型的播放布局
- 添加一个build.gradle(如下)
- 输入
gradle idea
生成想法的项目文件
在intellij中打开项目
plugins {
id'play'
id'idea'
}
repositories {
jcenter()
maven {
nametypesafe-maven-release
urlhttps://repo.typesafe.com/typesafe/maven-releases
}
ivy {
nametypesafe-ivy-release
urlhttps://repo.typesafe.com/typesafe/ivy-releases
布局ivy
}
}
idea {
module {
sourceDirs + = file(app)
testSourceDirs + = file(test)
scopes.COMPILE = [plus:[configura tions.play],minus:[]]
scopes.RUNTIME = [plus:[configurations.playRun],minus:[configurations.play]]
scopes.TEST = [plus:[configurations.playTest ],减去:[configurations.playRun]]
}
}
PS:用intellij 15.0.2 / gradle 2.10 / gradle play插件测试
Here is a Gradle build as advised here for using play web framework.
plugins {
id 'play'
id 'idea'
}
repositories {
jcenter()
maven {
name "typesafe-maven-release"
url "https://repo.typesafe.com/typesafe/maven-releases"
}
ivy {
name "typesafe-ivy-release"
url "https://repo.typesafe.com/typesafe/ivy-releases"
layout "ivy"
}
}
It works fine when building, launching etc... from command line but once the project is imported in intellij (idea's project files generated with gradle idea
), dependencies (from the play plugin) don't show up in the project view/external libraries (even after having hit "refresh all gradle projects" in the gradle panel).
Thanks :)
PS: intellij 15.0.2 / gradle 2.6 / play plugin
Answer found here. Apparently the gradle idea plugin needs to be told explicitely how to wire the dependencies.
To sum up :
- Create a typical play layout
- Add a build.gradle (as below)
- Type
gradle idea
to generate idea's project files Open the project in intellij
plugins { id 'play' id 'idea' } repositories { jcenter() maven { name "typesafe-maven-release" url "https://repo.typesafe.com/typesafe/maven-releases" } ivy { name "typesafe-ivy-release" url "https://repo.typesafe.com/typesafe/ivy-releases" layout "ivy" } } idea { module { sourceDirs += file("app") testSourceDirs += file("test") scopes.COMPILE = [plus: [configurations.play], minus: []] scopes.RUNTIME = [plus: [configurations.playRun], minus:[configurations.play]] scopes.TEST = [plus: [configurations.playTest], minus: [configurations.playRun]] } }
PS: tested with intellij 15.0.2 / gradle 2.10 / gradle play plugin
这篇关于如何使gradle / intellij / play框架一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!