persist-publish.gradle 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ext {
  2. artifactoryBaseUrl = 'https://maven.ubtob.net/artifactory'
  3. artifactorySnapshotRepoUrl = "$artifactoryBaseUrl/libs-snapshot-local"
  4. artifactoryReleaseRepoUrl = "$artifactoryBaseUrl/libs-release-local"
  5. }
  6. apply plugin: 'maven-publish'
  7. configurations {
  8. persist
  9. }
  10. task sourcesJar(type: Jar) {
  11. baseName "${project.name}"
  12. classifier 'sources'
  13. from sourceSets.main.allSource
  14. }
  15. task persistJar(type: Jar) {
  16. baseName "sso-persist"
  17. from sourceSets.main.output
  18. exclude "spring", "config"
  19. include "**/entity/**", "**/dao/**", "**/core/**", "**/util/**", "**/support/**"
  20. }
  21. task persistSourcesJar(type: Jar) {
  22. baseName "sso-persist"
  23. classifier 'sources'
  24. from sourceSets.main.allSource
  25. exclude "spring", "config"
  26. include "**/entity/**", "**/dao/**", "**/core/**", "**/util/**", "**/support/**"
  27. }
  28. // Create artifact for other project import
  29. artifacts {
  30. persist persistJar
  31. }
  32. publishing {
  33. publications {
  34. plugin(MavenPublication) {
  35. groupId "${project.group}"
  36. artifactId "${project.name}"
  37. version "${project.version}"
  38. from components.java
  39. artifact sourcesJar
  40. }
  41. persist(MavenPublication) {
  42. groupId "${project.group}"
  43. artifactId 'sso-persist'
  44. version "${project.version}"
  45. artifact persistJar
  46. artifact persistSourcesJar
  47. }
  48. }
  49. repositories {
  50. maven {
  51. name 'myLocal'
  52. url "file://$projectDir/repo"
  53. }
  54. maven {
  55. name 'remoteArtifactory'
  56. url project.version.endsWith('-SNAPSHOT') ? artifactorySnapshotRepoUrl : artifactoryReleaseRepoUrl
  57. credentials {
  58. username = 'admin'
  59. password = 'Admin2020yourkj2021'
  60. }
  61. }
  62. }
  63. }