DependencySetPlugin.groovy 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright 2002-2017 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package io.spring.gradle.convention;
  17. import org.gradle.api.Plugin
  18. import org.gradle.api.Project
  19. import org.gradle.api.plugins.JavaPlugin
  20. /**
  21. * Adds sets of dependencies to make it easy to add a grouping of dependencies. The
  22. * dependencies added are:
  23. *
  24. * <ul>
  25. * <li>sockDependencies</li>
  26. * <li>seleniumDependencies</li>
  27. * <li>gebDependencies</li>
  28. * <li>slf4jDependencies</li>
  29. * <li>jstlDependencies</li>
  30. * <li>apachedsDependencies</li>
  31. * </ul>
  32. *
  33. * @author Rob Winch
  34. */
  35. public class DependencySetPlugin implements Plugin<Project> {
  36. @Override
  37. public void apply(Project project) {
  38. project.ext.spockDependencies = [
  39. project.dependencies.create("org.spockframework:spock-spring") {
  40. exclude group: 'junit', module: 'junit-dep'
  41. },
  42. project.dependencies.create("org.spockframework:spock-core") {
  43. exclude group: 'junit', module: 'junit-dep'
  44. }
  45. ]
  46. project.ext.seleniumDependencies = [
  47. "org.seleniumhq.selenium:htmlunit-driver",
  48. "org.seleniumhq.selenium:selenium-support"
  49. ]
  50. project.ext.gebDependencies = project.spockDependencies +
  51. project.seleniumDependencies + [
  52. "org.gebish:geb-spock",
  53. 'commons-httpclient:commons-httpclient',
  54. "org.codehaus.groovy:groovy",
  55. "org.codehaus.groovy:groovy-all"
  56. ]
  57. project.ext.slf4jDependencies = [
  58. "org.slf4j:slf4j-api",
  59. "org.slf4j:jcl-over-slf4j",
  60. "org.slf4j:log4j-over-slf4j",
  61. "ch.qos.logback:logback-classic"
  62. ]
  63. project.ext.springCoreDependency = [
  64. project.dependencies.create("org.springframework:spring-core") {
  65. exclude(group: 'commons-logging', module: 'commons-logging')
  66. }
  67. ]
  68. project.ext.testDependencies = [
  69. "org.mockito:mockito-core",
  70. "org.springframework:spring-test",
  71. "org.assertj:assertj-core",
  72. "org.junit.jupiter:junit-jupiter-api",
  73. "org.junit.jupiter:junit-jupiter-params",
  74. "org.junit.jupiter:junit-jupiter-engine",
  75. "org.mockito:mockito-core",
  76. "org.mockito:mockito-junit-jupiter"
  77. ]
  78. project.ext.jstlDependencies = [
  79. "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api",
  80. "org.apache.taglibs:taglibs-standard-jstlel"
  81. ]
  82. project.ext.apachedsDependencies = [
  83. "org.apache.directory.server:apacheds-core",
  84. "org.apache.directory.server:apacheds-core-entry",
  85. "org.apache.directory.server:apacheds-protocol-shared",
  86. "org.apache.directory.server:apacheds-protocol-ldap",
  87. "org.apache.directory.server:apacheds-server-jndi",
  88. 'org.apache.directory.shared:shared-ldap'
  89. ]
  90. project.plugins.withType(JavaPlugin) {
  91. project.dependencies {
  92. testImplementation project.testDependencies
  93. }
  94. }
  95. }
  96. }