publish.gradle 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ext {
  2. artifactoryBaseUrl = 'http://maven.ubtob.net/artifactory'
  3. artifactorySnapshotRepoUrl = "$artifactoryBaseUrl/libs-snapshot-local"
  4. artifactoryReleaseRepoUrl = "$artifactoryBaseUrl/libs-release-local"
  5. }
  6. apply plugin: 'maven-publish'
  7. task sourcesJar(type: Jar) {
  8. baseName "${project.name}"
  9. classifier 'sources'
  10. from sourceSets.main.allSource
  11. }
  12. publishing {
  13. publications {
  14. plugin(MavenPublication) {
  15. groupId "${project.group}"
  16. artifactId "${project.name}"
  17. version "${project.version}"
  18. from components.java
  19. artifact sourcesJar
  20. }
  21. }
  22. repositories {
  23. maven {
  24. name 'myLocal'
  25. url "file://$projectDir/repo"
  26. }
  27. maven {
  28. name 'remoteArtifactory'
  29. url project.version.endsWith('-SNAPSHOT') ? artifactorySnapshotRepoUrl : artifactoryReleaseRepoUrl
  30. credentials {
  31. username = 'admin'
  32. password = 'Admin2020yourkj2021'
  33. }
  34. }
  35. }
  36. }