Guest User

Untitled

a guest
Jan 9th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. plugins {
  2. maven
  3. `maven-publish`
  4. }
  5.  
  6.  
  7. publishing {
  8. val repositoryUrl: String by project
  9. val repositoryUser: String by project
  10. val repositoryPassword: String by project
  11.  
  12. val sourcesJar by tasks.registering(Jar::class) {
  13. classifier = "sources"
  14. from(sourceSets.main.get().allSource)
  15. }
  16.  
  17. repositories {
  18. maven {
  19. url = uri(repositoryUrl)
  20. credentials {
  21. username = repositoryUser
  22. password = repositoryPassword
  23. }
  24. }
  25. }
  26. publications {
  27. register("mavenJava", MavenPublication::class) {
  28. from(components["java"])
  29. artifact(sourcesJar.get())
  30. }
  31. }
  32. }
  33.  
  34. getByName<Upload>("uploadArchives") {
  35. val repositoryUrl: String by project
  36. val repositoryUser: String by project
  37. val repositoryPassword: String by project
  38. repositories {
  39. withConvention(MavenRepositoryHandlerConvention::class) {
  40. mavenDeployer {
  41. withGroovyBuilder {
  42. "repository"("url" to uri(repositoryUrl)) {
  43. "authentication"("userName" to repositoryUser, "password" to repositoryPassword)
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
Add Comment
Please, Sign In to add comment