2017-12-18 1 views
1

Bintray에 Hibernate ORM jars를 게시하고 싶습니다. 그러나 우리가 가지고있는 하나의 요구 사항은 Bintray가 이제이 OJO 저장소를 통해 지원하는 스냅 샷을 게시 할 수 있다는 것입니다. 그러나이 설명서를 읽은 후에 이것이 어떻게 작동해야하는지에 대해서는 상당히 혼란 스럽습니다.BinTray에 스냅 샷을 게시하는 프로세스에 대해 혼동을 들었습니다.

첫 번째 문서에서는 JCenter에 게시를 요청할 수 있어야하며 동시에 스냅 샷을 게시 할 수 있도록 요청할 수 있어야한다고 언급합니다. 그러나 나는 그런 선택의 여지가 없다 : https://bintray.com/hibernate/artifacts/hibernate-orm

둘째, OJO에 대한 계정을 설정 한 후에 Bintray/Gradle 플러그인으로 특별한 작업을 수행해야합니까?

+0

FWIW이 6 개월 동안 bintray Gradle을 플러그인에 대한 의문/문제가있다 : https://github.com/bintray/gradle-bintray-plugin/issues/191 –

답변

1

많은 시행 착오 끝에 다음 설정으로 끝났습니다.

우리는 출판 2 개의 다른 플러그인 사용

  • 스냅 샷을하고 (프로젝트 p6spy에서) 출판 (com.jfrog.artifactory 사용) 및
  • bintray 관련 활동 Gradle을에 (com.jfrog.bintray를 사용)를 놓습니다.

    plugins { 
        ... 
        // to publish !SNAPSHOTs to bintray and sync it to maven-central 
        // ./gradlew bintrayUpload 
        id 'com.jfrog.bintray' version '1.7.3' 
        // to publish SNAPSHOTs and !SNAPSHOTs to oss.jfrog.org 
        // ./gradlew artifactoryPublish 
        id 'com.jfrog.artifactory' version '4.5.2' 
    } 
    
    publishing { 
        publications { 
        maven(MavenPublication) { 
         from components.java 
         groupId project.group 
         artifactId project.archivesBaseName 
         version project.version 
    
         ... 
    
         pom { 
         packaging 'jar' 
         withXml { 
          asNode().children().last() + { 
          def builder = delegate 
    
          // maven central publishing mandatories 
          builder.name project.name 
          builder.description description 
          builder.url 'https://github.com/p6spy/p6spy' 
    
          builder.licenses { 
           builder.license { 
            builder.name 'The Apache Software License, Version 2.0' 
            builder.url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 
            builder.distribution 'repo' 
           } 
          } 
          builder.scm { 
           builder.url 'http://github.com/p6spy/p6spy' 
           builder.connection 'scm:git:git://github.com/p6spy/p6spy.git' 
           builder.developerConnection 'scm:git:ssh://github.com:p6spy/p6spy.git' 
          } 
          builder.developers { 
           builder.developer { 
            builder.name 'Quinton McCombs' 
            builder.email '[email protected]' 
           } 
           builder.developer { 
            builder.name 'Peter Butkovic' 
            builder.email '[email protected]' 
           } 
           builder.developer { 
            builder.name 'Felix Barnsteiner' 
            builder.email '[email protected]' 
           } 
          } 
    
          // maven central publishing optionals 
          builder.issueManagement { 
           builder.system 'github' 
           builder.url 'https://github.com/p6spy/p6spy/issues' 
          } 
          builder.ciManagement { 
           builder.system 'Travis CI' 
           builder.url 'https://travis-ci.org/p6spy/p6spy' 
          } 
          } 
         } 
         } 
        } 
        } 
    } 
    
    // to publish SNAPSHOTs to http://oss.jfrog.org/oss-snapshot-local/ 
    // and !SNAPSHOTs to http://oss.jfrog.org/oss-release-local/ 
    artifactory { 
        contextUrl = 'https://oss.jfrog.org' 
        resolve { 
         repository { 
          repoKey = 'libs-release' 
         } 
        } 
        publish { 
         repository { 
          // The Artifactory repository key to publish to 
          // when using oss.jfrog.org the credentials are from Bintray. 
          if (project.version.endsWith("-SNAPSHOT")) { 
           repoKey = 'oss-snapshot-local' 
          } else { 
           repoKey = 'oss-release-local' 
          } 
    
          username = System.getenv('BINTRAY_USER') 
          password = System.getenv('BINTRAY_API_KEY') 
         } 
         defaults { 
          publications 'maven' 
          properties = [ 'bintray.repo': 'p6spy/maven', 'bintray.package': 'p6spy:p6spy', 'bintray.version': project.version.toString() ] 
         } 
        } 
    } 
    
    // to publish to bintray and later sync to maven-central 
    bintray { 
        user = System.getenv('BINTRAY_USER') 
        key = System.getenv('BINTRAY_API_KEY') 
        publications = ['maven'] 
        // dryRun = true 
        // publish = true 
        pkg { 
        repo = 'maven' 
        name = 'p6spy:p6spy' 
        userOrg = group 
        desc = description 
        websiteUrl = 'https://github.com/p6spy/p6spy' 
        issueTrackerUrl = 'https://github.com/p6spy/p6spy/issues' 
        vcsUrl = 'https://github.com/p6spy/p6spy.git' 
        licenses = ['Apache-2.0'] 
        publicDownloadNumbers = true 
        githubRepo = 'p6spy/p6spy' 
        githubReleaseNotesFile = 'docs/releasenotes.md' 
        version { 
         released = new Date() 
         name = project.version 
         vcsTag = "p6spy-${project.version}" 
    
         // Optional configuration for Maven Central sync of the version 
         mavenCentralSync { 
          sync = true //[Default: true] Determines whether to sync the version to Maven Central. 
          close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually. 
          user = System.getenv('SONATYPE_USERNAME') //OSS user token: mandatory 
          password = System.getenv('SONATYPE_PASSWORD') //OSS user password: mandatory 
         } 
        } 
        } 
    } 
    

    UPDATE 게시

    :

    • 스냅 샷에 다음과 같습니다 build.gradle 파일의 추적에서

    관련 부분은 프로젝트의 세부 사항을 유의하시기 바랍니다 http://oss.jfrog.org/oss-snapshot-local/p6spy/p6spy/을 (난 그냥 공식 문서를 따라 : https://www.jfrog.com/confluence/display/RTF/Deploying+Snapshots+to+oss.jfrog.org)

  • 출시에 결국 : http://oss.jfrog.org/oss-release-local/p6spy/p6spy/하고 있습니다 나중에 자동으로 동기화 중앙 받는다는하기 : http://repo1.maven.org/maven2/p6spy/p6spy/
+0

감사합니다 피터! 그것은 참으로 어수선하며 나는 더 이상 내 혼란에 대해 나쁘게 생각하지 않습니다 :) 나는 누군가 이것을 이미 알아 냈기 때문에 매우 기쁩니다. –

+0

괜찮으 시다면 Bintray 사용 경험을 공유해 주시겠습니까? 도움을받는 것이 매우 어려워 보이는 것이 매우 불안합니다. 우리는 Bintray와 Sonatype의 OSSRH 사이에서 결정하려고합니다. 나는 Bintray를 매우 선호하지만 도움을 얻는 것 같은 어려움이있는 것은 확실한 관심사이다. 감사! https://hibernate.atlassian.net/browse/HHH-12172 –

+0

글쎄, 솔직히 말해서, 내 기억은 정말 나쁘다. 그리고 분 전에'travis.yml'을 조사한 결과, 단 하나의 플러그인 만 사용된다는 것을 알게되었다. oss.jfrog.org에 게시하기 위해 다른 사람은 bintray 관련 활동을 수행합니다. 혼란을 드려 죄송합니다. 나는 대답을 업데이트했다. –

관련 문제