使用gradle 时有一些繁琐的创建工程 使用插件的步骤。 这些步骤可以使用一些gradle的模板来代替。

具体的操作步骤:

安装gradle:

Prerequired: Java SDK installed

1. Dowload Gradle from: http://gradle.org/downloads
2. Set gradle home environment variable: GRADLE_HOME. Pointing to the place where the gradle binaries is
3. Add %GRADLE_HOME%\bin; to your PATH environment variable string
4. Run gradle -v command to test your installation and configuration is correct

 

 应用gradle的模板:

下载gradle模板,推荐使用 https://github.com/townsfolk/gradle-templates 下载zip文件即可,解压缩到路径(比如 D:\gradle-template)

找到 %userprofile%/.gradle/init.gradle文件(如果没有请参照http://gradle.org/docs/current/userguide/init_scripts.html 创建一个)

 文件内容:

gradle.beforeProject { prj ->
    prj.apply from: 'E:\\gradle\\gradle-templates\\installation\\apply.groovy'
}

cmd命令执行。 gradle tasks. 可以看到template中涉及到的命令都被加载了

Gradle templates 的使用

 

相关文章:

  • 2021-12-25
  • 2022-12-23
  • 2022-01-03
  • 2022-01-08
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-08-20
  • 2021-09-12
  • 2021-07-06
  • 2021-11-25
相关资源
相似解决方案