如何让 gradle / intellij / play 框架协同工作?

2024-01-09

这是建议的 Gradle 构建here https://docs.gradle.org/current/userguide/play_plugin.html用于使用 Play Web 框架。

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"
  }
}

从命令行构建、启动等时它工作正常,但是一旦将项目导入intellij(使用idea生成的项目文件)gradle idea),依赖项(来自 play 插件)不会显示在项目视图/外部库中(即使在 gradle 面板中点击“刷新所有 gradle 项目”之后)。

谢谢 :)

PS:intellij 15.0.2/gradle 2.6/播放插件 https://docs.gradle.org/current/userguide/play_plugin.html


找到答案here https://discuss.gradle.org/t/intellij-play-2-integration/12265。显然,需要明确告诉 gradle idea 插件如何连接依赖项。

总结 :

  1. 创建典型的游戏布局
  2. 添加build.gradle(如下)
  3. Type gradle idea生成idea的项目文件
  4. 在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:使用 intellij 15.0.2 / gradle 2.10 / gradle play 插件进行测试

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何让 gradle / intellij / play 框架协同工作? 的相关文章

随机推荐