简体   繁体   English

上传到bintray.com的文件有什么区别?

[英]What is the difference between Files uploaded to bintray.com?

I uploaded my lib to bintray.com by the tutorial , and now there in tab "Files" exist the list of files. 我通过教程将我的lib上传到bintray.com,现在在“文件”选项卡中存在文件列表。

1) Which one can I add directly to app/libs folder 1)我可以直接添加到app/libs文件夹中

2) What is the difference between Files uploaded to bintray.com? 2)上传到bintray.com的文件有什么区别?

3) How to find the files in MyProject without make command gradlew bintrayUpload ? 3)如何在没有make命令的情况下在MyProject中查找文件gradlew bintrayUpload

*-javadoc.jar 
*-javadoc.jar.asc 
*-sources.jar 
*-sources.jar.asc 
*.aar 
*.aar.asc 
*.pom 
*.pom.asc

在此输入图像描述

Let's take the questions one at a time: 我们一次一个地提出问题:

1) Which one can I add directly to app/libs folder 1)我可以直接添加到app / libs文件夹中

That would be *.aar file. 那将是*.aar文件。 The .aar file contains your compiled code & other resources you defined in your library (for instance XML files). .aar文件包含您在库中定义的已编译代码和其他资源(例如XML文件)。

AAR stands for Android Archive . AAR代表Android档案 It's Android's new binary format for libraries, an equivalent of a *.jar from the Java world. 它是Android的新二进制格式库,相当于Java世界的*.jar (see this ) (见这个

This contains just the compiled code though. 这只包含已编译的代码。 No javadoc, no sources. 没有javadoc,没有消息来源。

2) What is the difference between Files uploaded to bintray.com? 2)上传到bintray.com的文件有什么区别?

Let's take each file one by one: 让我们逐个采取每个文件:

1. <library name>.pom 1. <library name>.pom

This is a XML file that stores metadata about your library. 这是一个存储有关库的元数据的XML文件。

Typically, it stores the following: 通常,它存储以下内容:

  • the name of your artifact (eg mylibrary ) 你的工件的名称(例如mylibrary
  • the group (ie organization) which published the artifact (eg com.myname.mycompany ) 发布工件的组(即组织)(例如com.myname.mycompany
  • the version of your library (ie 0.0.4) 你的库的版本(即0.0.4)
  • packaging - defines what file type the binary is (it's aar for Android library, war for certain Java libraries, etc) packaging -定义二进制是什么文件类型(这是aar的Android库, war对于某些Java库等)
  • one or more dependencies of your library 您库的一个或多个依赖项

POM files are just the standard metadata file for Maven repositories. POM文件只是Maven存储库的标准元数据文件。 There are other types of repositories, such as Ivy repositories , which use other XML formats for their metadata: Ivy.xml files . 还有其他类型的存储库,例如Ivy存储库 ,它们使用其他XML格式作为其元数据: Ivy.xml文件

Since your repository is a Maven repository, the metadata is stored in a -pom.xml file. 由于您的存储库是Maven存储库,因此元数据存储在-pom.xml文件中。

2. <library name>.aar 2. <library name>.aar

As explained above, this stores the compiled Java/Kotkin code. 如上所述,这存储了编译的Java / Kotkin代码。 Also containes various Android resources, such as Strings, Drawables, Layout files, themes, stylables, etc. 还包含各种Android资源,如字符串,Drawables,布局文件,主题,样式等。

See here for details. 详情请见此处

3. library name>-javadoc.jar 3. library name>-javadoc.jar

Stores HTML documentation files generated from your code using the javadoc tool (or dokka if you used Kotlin). 使用javadoc工具存储从您的代码生成的HTML文档文件(如果您使用Kotlin,则dokka )。

This is just an archive, not an executable. 这只是一个存档,而不是可执行文件。 You can just open it with Total Commander or WinRar and check its contents. 您可以使用Total Commander或WinRar打开它并检查其内容。

4. library name>-sources.jar 4. library name>-sources.jar

Contains the sources for your library. 包含库的源代码。 This again is just an archive, not an executable. 这又是一个存档,而不是可执行文件。

It contains your actual *.java or *.kotlin files, complete with comments. 它包含您的实际*.java*.kotlin文件,以及注释。 Having this file allows clients of your library to properly see your code, step over it line by line, and better understand what your code does. 拥有此文件允许您的库的客户端正确地查看您的代码,逐行检查它,并更好地了解您的代码所做的事情。

This is also the file that gets read by the IDE when someone opens the documentation for a class of a your library, to show you the documentation for that class within the IDE. 当有人打开库的类文档时,这也是IDE读取的文件,以便在IDE中显示该类的文档。 Without this file they would have to use the online documentation or to look at the files from <library-name>-javadoc.jar . 如果没有此文件,他们将不得不使用在线文档或查看<library-name>-javadoc.jar中的文件。

Be careful if you library is not open source & has proprietary code: Do not also publish the sources! 如果您的库不是开源的并且拥有专有代码,请小心: 不要发布源代码!

5. <library-name>.<extension>.asc 5. <library-name>.<extension>.asc

It's a file generated by Bintray to guarantee that you're the one who uploaded the file. 这是Bintray生成的文件,用于保证您是上传文件的人。 This is why all your files have also an *.asc corespondent. 这就是为什么你的所有文件都有一个*.asc

Think of it as a digital signature for each of your files. 可以将其视为每个文件的数字签名。 It's actually created by the steps in "Part 3" of the tutorial you linked. 它实际上是由您链接的教程的“第3部分”中的步骤创建的。 If you skip Part 3, then no ` .asc files will be generated. 如果跳过第3部分,则不会生成` .asc文件。

3) How to find the files in MyProject without make command gradlew bintrayUpload? 3)如何在没有make命令的情况下在MyProject中查找文件gradlew bintrayUpload?

*.pom

I assume you're using the Bintray Gradle Plugin, since you mentioned the bintrayUpload task. 我假设您正在使用Bintray Gradle插件,因为您提到了bintrayUpload任务。

Somewhere in your gradle files, you should have something like this: 在你的gradle文件中的某个地方,你应该有这样的东西:

publishing {
    publications {
        MyPublicationName(MavenPublication) {
        ...
        }
    }
}

This defines a publication object called MyPublicationName . 这定义了一个名为MyPublicationName的发布对象。

Thanks to the Bintray Gradle plugin, then you should have the following task available: generatePomFileForMyPublicationNamePublication . 感谢Bintray Gradle插件,您应该可以使用以下任务: generatePomFileForMyPublicationNamePublication

So to generate the *.pom you have to run: 因此要生成*.pom您必须运行:

./gradle generatePomFileForMyPublicationNamePublication

Replace MyPublicationName with the name you defined for your publication. MyPublicationName替换为您为发布定义的名称。

*.aar

./gradle :moduleName:assembleRelease

Just replace moduleName with the name of your library module. 只需将moduleName替换为库模块的名称即可。

*-sources.jar

You need to define a task which archives your source files under a jar. 您需要定义一个将源文件归档到jar下的任务。 Mine looks the following way: 我看起来如下:

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

Then you can just call: 然后你可以打电话:

./gradle :moduleName:sourcesJar

As before, replace moduleName with the name of your library module. 和以前一样,将moduleName替换为库模块的名称。

*-javadoc.jar

You typically need to define 2 tasks for this: 您通常需要为此定义2个任务:

  1. One task which invokes the javadoc tool over your classes, to generate the HTML documentation files from the documentation present in your code. 一个任务是在类上调用javadoc工具,从代码中的文档生成HTML文档文件。
  2. A second task which takes the HTML files and bundles them in a .jar file (like we did for the sources.jar file) 第二个任务,它接收HTML文件并将它们捆绑在.jar文件中(就像我们为sources.jar文件所做的那样)

My setup looks in the following way: 我的设置以下列方式查看:

//generates HTML files from the documentation present in your source files
task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    failOnError false
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

//takes the generated html documentation files, and archives them in a jar
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

Then invoke: 然后调用:

./gradle :moduleName:javadocJar

And you're set! 你就定了! Also, replace moduleName with the name of your library module. 另外,将moduleName替换为库模块的名称。

*.asc

These files are actually generated by Bintray after you upload your files. 上传文件后,这些文件实际上是由Bintray生成的。 There's no need to generate them locally. 没有必要在本地生成它们。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将Android库上传到bintray.com中的JCenter存储库 - Can not upload android library to JCenter repository in bintray.com 将lib上传到bintray.com时无法在电子邮件上获取gpg密钥 - Not able to get gpg keys on email while uploading lib to bintray.com .class和.dex文件有什么区别? - What is the difference between .class and .dex files? Android-这三个xml文件有什么区别? - Android - What is the difference between these three xml files? android 和 com.android 有什么区别? - What's the difference between android and com.android? -keep类com.sample.Foo {*;}和-keep类com.sample.Foo有什么区别? - What's the difference between -keep class com.sample.Foo {*;} and -keep class com.sample.Foo? com.mcxiaoke.volley:library-aar和com.mcxiaoke.volley:library有什么区别? - what is the difference between com.mcxiaoke.volley:library-aar and com.mcxiaoke.volley:library? 使用“ com.facebook.android.LoginButton”和“ com.facebook.widget.LoginButton”有什么区别? - What is the difference between using “com.facebook.android.LoginButton” and “com.facebook.widget.LoginButton”? 软件包上传到Bintray,但Gradle解析失败 - Package uploaded on Bintray but Gradle resolution failed android art elf和Linux elf文件有什么区别? - What is the difference between android art elf and Linux elf files?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM