总结

下面是一个完整的构建文件的样本:

Example 7.9. Java 例子 - 完整的构建文件

build.gradle

  1. apply plugin: 'java'
  2. apply plugin: 'eclipse'
  3. sourceCompatibility = 1.5
  4. version = '1.0'
  5. jar {
  6. manifest {
  7. attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
  8. }
  9. }
  10. repositories {
  11. mavenCentral()
  12. }
  13. dependencies {
  14. compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
  15. testCompile group: 'junit', name: 'junit', version: '4.+'
  16. }
  17. test {
  18. systemProperties 'property': 'value'
  19. }
  20. uploadArchives {
  21. repositories {
  22. flatDir {
  23. dirs 'repos'
  24. }
  25. }
  26. }