publish.gradle 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. tasks.withType(JavaCompile) {
  8. options.encoding = 'UTF-8'
  9. }
  10. task sourcesJar(type: Jar) {
  11. baseName "${project.name}"
  12. classifier 'sources'
  13. from sourceSets.main.allSource
  14. }
  15. publishing {
  16. publications {
  17. manage(MavenPublication) {
  18. groupId "${project.group}"
  19. artifactId "${project.name}"
  20. version "${project.version}"
  21. artifact jar
  22. artifact sourcesJar
  23. }
  24. }
  25. repositories {
  26. maven {
  27. name 'remoteArtifactory'
  28. url project.version.endsWith('-SNAPSHOT') ? artifactorySnapshotRepoUrl : artifactoryReleaseRepoUrl
  29. credentials {
  30. username = 'admin'
  31. password = 'Admin2020yourkj2021'
  32. }
  33. }
  34. }
  35. }