SpringModulePlugin.groovy 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright 2016-2019 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.Project
  18. import org.gradle.api.plugins.JavaLibraryPlugin;
  19. import org.gradle.api.plugins.MavenPlugin;
  20. import org.gradle.api.plugins.PluginManager
  21. import org.springframework.gradle.classpath.CheckClasspathForProhibitedDependenciesPlugin;
  22. import org.springframework.gradle.maven.SpringMavenPlugin;
  23. /**
  24. * @author Rob Winch
  25. */
  26. class SpringModulePlugin extends AbstractSpringJavaPlugin {
  27. @Override
  28. void additionalPlugins(Project project) {
  29. PluginManager pluginManager = project.getPluginManager();
  30. pluginManager.apply(JavaLibraryPlugin.class)
  31. pluginManager.apply(SpringMavenPlugin.class);
  32. pluginManager.apply(CheckClasspathForProhibitedDependenciesPlugin.class);
  33. pluginManager.apply("io.spring.convention.jacoco");
  34. def deployArtifacts = project.task("deployArtifacts")
  35. deployArtifacts.group = 'Deploy tasks'
  36. deployArtifacts.description = "Deploys the artifacts to either Artifactory or Maven Central"
  37. if (!Utils.isRelease(project)) {
  38. deployArtifacts.dependsOn project.tasks.artifactoryPublish
  39. }
  40. }
  41. }