How to make gradle / intellij / play framework work together?

后端 未结 3 1490
名媛妹妹
名媛妹妹 2021-02-09 09:23

Here is a Gradle build as advised here for using play web framework.

plugins {
  id \'play\'
  id \'idea\'
}

reposit         


        
3条回答
  •  执笔经年
    2021-02-09 10:16

    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

提交回复
热议问题