如何使gradle / intellij / play框架一起工作? [英] How to make gradle / intellij / play framework work together?

查看:113
本文介绍了如何使gradle / intellij / play框架一起工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是建议的

解决方案

找到答案 here 一>。显然,gradle idea插件需要被明确地告知如何连接依赖关系。



总结:


  1. 创建一个典型的播放布局
  2. 添加一个build.gradle(如下)

  3. 输入 gradle idea 生成想法的项目文件

  4. 在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 :

  1. Create a typical play layout
  2. Add a build.gradle (as below)
  3. Type gradle idea to generate idea's project files
  4. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆