2016-10-07 2 views
0

bintray에 lib를 게시하려고합니다. 그러나 만들어진 jar 파일에는 META-INF 폴더 만 있고 클래스 파일은 없습니다.bintrayUpload 이후 Jar 파일에 클래스 파일이 없습니다.

나는 가이드 https://github.com/bintray/gradle-bintray-plugin#readme에 따라 왔지만 작동시키지 못했습니다.

내 그라디언트 파일의 모습입니다.

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

plugins { 
    id "com.jfrog.bintray" version "1.7" 
} 

apply plugin: 'maven-publish' 
apply plugin: 'java' 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

publishing { 
    publications { 
     MyPublication(MavenPublication) { 
      from components.java 
      groupId '' 
      artifactId '' 
      version '1.0' 
     } 
    } 
} 

bintray { 
    user = '' 
    key = '' 
    publications = ['MyPublication'] 
    pkg { 
     repo = 'maven' 
     name = '' 
     desc = '' 
     licenses = ['Apache-2.0'] 
     websiteUrl = '' 
     vcsUrl = '' 
     version { 
      name = '1.0' 
      vcsTag = '1.0' 
      released = new Date() 
      attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin'] 
     } 
    } 
} 

은 그 때 나는 gradlew bintrayUpload를 실행하고는 bintray에 업로드되어 있지만, jar 파일은 단지 META-INF 폴더, 아니 클래스 파일이 포함되어 있습니다.

답변

0

나는 그것을 고칠 수 있었다. 가장 큰 차이점은 bintray로 푸시 할 때 게시 대신 구성을 사용한다는 것입니다. 아래는 내가 작동하도록 설정 한 gradle 파일입니다. 그런 다음 gradlew bintrayUpload를 실행하십시오. 문제 해결을 위해 수정하지 못한 오류 메시지가 표시되었지만 업로드 할 때 수정하지 않아도됩니다. 루트 build.gradle mylib.gradle 파일의 끝에서

plugins { 
    id "com.jfrog.bintray" version "1.7" 
    id "com.github.dcendents.android-maven" version "1.5" 
} 

에서

// bintrayUpload config 
apply from: 'bintray-publish.gradle' 

bintray-publish.gradle

apply plugin: 'com.github.dcendents.android-maven' 
apply plugin: 'com.jfrog.bintray' 

// Maven group id and version for the artifact 
group = LIB_GROUP_ID 
version = LIB_VERSION 

install { 
    repositories.mavenInstaller { 
     // This generates POM.xml with proper parameters 
     pom { 
      project { 
       packaging POM_PACKAGING 
       groupId LIB_GROUP_ID 
       artifactId LIB_ARTIFACT_ID 

       name LIB_NAME 
       description LIB_DESCRIPTION 
       url LIB_URL 

       developers { 
        developer { 
         id POM_DEVELOPER_ID 
         name POM_DEVELOPER_NAME 
        } 
       } 

       scm { 
        url POM_SCM_URL 
        connection POM_SCM_CONNECTION 
        developerConnection POM_SCM_DEV_CONNECTION 
       } 

       licenses { 
        license { 
         name POM_LICENCE_NAME 
         url POM_LICENCE_URL 
         distribution POM_LICENCE_DIST 
        } 
       } 
      } 
     } 
    } 
} 

task sourcesJar(type: Jar) { 
    from android.sourceSets.main.java.srcDirs 
    classifier = 'sources' 
} 

task javadoc(type: Javadoc) { 
    source = android.sourceSets.main.java.srcDirs 
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 
} 

task javadocJar(type: Jar, dependsOn: javadoc) { 
    classifier = 'javadoc' 
    from javadoc.destinationDir 
} 

artifacts { 
    // TODO: Java doc generates errors for some reason, disable for now 
    //archives javadocJar 
    archives sourcesJar 
} 

Properties properties = new Properties() 
properties.load(project.rootProject.file('local.properties').newDataInputStream()) 

bintray { 
    user = POM_DEVELOPER_ID 
    key = properties.getProperty("bintray.apikey") 

    configurations = ['archives'] 
    pkg { 
     repo = 'maven' 
     name = BIN_TRAY_NAME 
     desc = LIB_DESCRIPTION 
     licenses = ['Apache-2.0'] 
     websiteUrl = LIB_URL 
     vcsUrl = LIB_VCS_URL 
     publish = true 
     dryRun = false 
     version { 
      name = LIB_VERSION 
      desc = LIB_DESCRIPTION 
      released = new Date() 
     } 
    } 
} 

gradle.properties

BIN_TRAY_NAME = MyLib 
LIB_VERSION = 1.0.0 
LIB_GROUP_ID = com.xxx.mylib 

# The artifact name should be the same as the library module name 
LIB_ARTIFACT_ID = mylib 

LIB_NAME = MyLib 
LIB_DESCRIPTION = My desc 
LIB_URL = https://github.com/xxx/mylib 
LIB_VCS_URL = https://github.com/xxx/mylib.git 

POM_DEVELOPER_ID = My bintray id 
POM_DEVELOPER_NAME = My bintray name 
POM_SCM_URL = scm:[email protected]/xxx/mylib.git 
POM_SCM_CONNECTION = scm:[email protected]/xxx/mylib.git 
POM_SCM_DEV_CONNECTION = scm:[email protected]/xxx/mylib.git 
POM_LICENCE_NAME = The Apache Software License, Version 2.0 
POM_LICENCE_URL = http://www.apache.org/licenses/LICENSE-2.0.txt 
POM_LICENCE_DIST=repo 
POM_PACKAGING = aar 
관련 문제