简体   繁体   English

Android在Maven中使用github库是安全的

[英]Android is it safe to use github libraries with maven

I'm using a Gradle build system with Android Studio and have a couple of questions regarding the use of maven dependencies. 我正在使用带有Android Studio的Gradle构建系统,并且对使用Maven依赖项有一些疑问。

I'm using a library from github and I'm wondering if its safe to include it as a maven dependency, or if its better to include the library into the project a different way. 我正在使用来自github的库,并且想知道将其作为maven依赖项包括在库中是否安全,或者以其他方式将库包含在项目中是否更好。 What happens if the owner removes the library from github? 如果所有者从github删除库,会发生什么? Will my app cease to work? 我的应用程序将停止工作吗? If so then is it better to just directly include the library in my project? 如果是这样,那么直接将库包含在我的项目中会更好吗?

To be honest I'm still a bit unclear on the details of using repositories through maven and gradle, but I'd like to know the limitations of using a library this way. 老实说,我仍然不清楚通过maven和gradle使用存储库的细节,但是我想知道以这种方式使用库的局限性。

I managed to implement a library by adding a JitPack repository to my build file build.gradle, but I'm worried about the possibility of the owner removing the library rendering the app unusable. 我设法通过在构建文件build.gradle中添加JitPack存储库来实现一个库,但是我担心所有者可能删除该库而导致该应用无法使用。 Here's the following blocks of code that I used to implement the library: 这是我用来实现该库的以下代码块:

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.github.windyzboy:CustomEditor:v1.0.1'
}

Does this download the files and place it in my project, or is it referencing the library somehow? 这会下载文件并将其放入我的项目中,还是以某种方式引用了库? If the owner of the repository removes their library, will my app still be able to use it? 如果存储库的所有者删除了他们的库,我的应用程序仍然可以使用它吗?

From Frequently Asked Questions 来自常见问题

What happens if a tag or repository is deleted on GitHub? 如果在GitHub上删除标签或存储库会怎样?

If the project was already built then JitPack will continue serving the existing artifacts. 如果已经构建了项目,那么JitPack将继续提供现有的工件。 It will not rebuild the project at the new tag. 它不会在新标签处重建项目。 In case you need to redo a release the best option is to create a new version on GitHub. 如果您需要重做发行,最好的选择是在GitHub上创建一个新版本。

From my experience it's only possible to delete a successful build for up to seven days. 根据我的经验,最多只能删除成功的构建长达七天。 But I couldn't find any official documentation about it. 但是我找不到关于它的任何官方文档。 But I guess everyone learned from the NPM disaster. 但是我想每个人都从NPM灾难中学到了东西。

Just use it. 只需使用它。 Many do so. 许多这样做。 It's the only channel I use for publishing my own projects so far. 到目前为止,这是我用来发布自己的项目的唯一渠道。 Your only issue is the service going down. 您唯一的问题是服务中断。 But that's a valid concern for any other service as well. 但这对于任何其他服务也是一个有效的问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM