简体   繁体   中英

How to install gradle-grails-plugin?

Complete gradle nooby here.

I want to be able to execute grails build commands like "grails compile", "grails test-app" and so forth from gradle.

I found the grails-gradle-plugin from Peter Ledbrook at: https://github.com/grails/grails-gradle-plugin .

Cloning the repository I get some files and folders. In the readme file it says " include the required JARs via buildscript {} and 'apply' the plugin". The apply part sure I get but how do I add the JAR? And which jar? Do I need to use gradle on the build file in the folder of the downloaded plug-in and compile a jar? And ones I get the jar where do I place it and how do I include it in my projects build.gradle file?

I have a feeling this is going to be ridiculously easy but I just can't get it to work.

In Gradle, the jars are added to build script or to your application class path through dependencies closure eg

dependencies { 
  compile "org.grails:grails-crud:1.3.4"
  compile "org.grails:grails-gorm:1.3.4"
  compile "ch.qos.logback:logback-core:1.0.7"
  compile "org.slf4j:slf4j-api:1.7.2"
}

compile is a name of one of the many configurations (there are also test , runtime etc.) and eg " org.grails:grails-crud:1.3.4 " is a reference to a jar in one of the public repositories, which are also specified in your scripts in repositories closure.

You can read more about Gradle dependency management in http://gradle.org/docs/current/userguide/dependency_management.html .

For your Grails project you need to define a build.gradle file which looks similar to what is described in the README.

Though I tried today to just create a simple Grails project using that plugin and gradle init command and it didn't work. I have created an issue for that: https://github.com/grails/grails-gradle-plugin/issues/16 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM