publish.gradle 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. apply plugin: 'com.jfrog.artifactory'
  2. apply plugin: 'maven-publish'
  3. def ARTIFACT_ID = "ble-protocol"
  4. def packageName = "com.vivachek.ble"
  5. def libVersion = "0.0.1"
  6. task sourcesJar(type: Jar) {
  7. from sourceSets.main.java.srcDirs
  8. archiveClassifier = 'sources'
  9. }
  10. task javadocJar(type: Jar) {
  11. from javadoc
  12. archiveClassifier = 'javadoc'
  13. }
  14. publishing {
  15. publications {
  16. jar(MavenPublication) {
  17. groupId = packageName
  18. version = libVersion
  19. artifactId = ARTIFACT_ID
  20. from components.java
  21. // 生成源码包
  22. artifact sourcesJar
  23. // 生成javadoc包
  24. // artifact javadocJar
  25. }
  26. }
  27. }
  28. artifactory {
  29. contextUrl = artifactory_contextUrl
  30. publish {
  31. repository {
  32. repoKey = artifactory_repokey
  33. username = artifactory_username
  34. password = artifactory_password
  35. maven = true
  36. }
  37. defaults {
  38. // Tell the Artifactory Plugin which artifacts should be published to Artifactory.
  39. publications('jar')
  40. publishArtifacts = true
  41. // Properties to be attached to the published artifacts.
  42. properties = ['qa.level': 'basic', 'dev.team': 'core']
  43. // Publish generated POM files to Artifactory (true by default)
  44. publishPom = true
  45. }
  46. }
  47. }