如果我将我的库添加到项目中,然后运行命令:
> gradlew -q app:dependencies --configuration debugCompileClasspath > app_dependencies_compile.txt
为什么 com.github.kolyall:utils:1.0.4 lib 使用 获取 范围?如果它们的范围应该是com.android.support:appcompat-v7 lib(和其他) CompileClasspath 中的 >runtime运行时,为什么要将它们添加到CompileClasspath?
输出是:
\--- com.github.kolyall:utils:1.0.4
+--- net.danlew:android.joda:2.8.2
| \--- joda-time:joda-time:2.8.2
+--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
+--- com.android.support:design:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-utils:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-fragment:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:transition:28.0.0-alpha3
| | +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| | \--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:cardview-v7:28.0.0-alpha3
| | \--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| \--- com.android.support:recyclerview-v7:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| \--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
+--- io.reactivex:rxjava:1.3.0
+--- io.reactivex:rxandroid:1.2.1
\--- javax.annotation:jsr250-api:1.0
完整的输出是:
Executing tasks: [dependencies, --configuration, debugCompileClasspath]
:app:dependencies
------------------------------------------------------------
Project :app
------------------------------------------------------------
debugCompileClasspath - Resolved configuration for compilation for variant: debug
+--- com.android.support:appcompat-v7:28.0.0
| +--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-compat:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:collections:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | +--- android.arch.lifecycle:runtime:1.1.1
| | | +--- android.arch.lifecycle:common:1.1.1
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | +--- android.arch.core:common:1.1.1
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | \--- com.android.support:versionedparcelable:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | \--- com.android.support:collections:28.0.0 (*)
| +--- com.android.support:collections:28.0.0 (*)
| +--- com.android.support:cursoradapter:28.0.0
| | \--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-core-utils:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:support-compat:28.0.0 (*)
| | +--- com.android.support:documentfile:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:loader:28.0.0
| | | +--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:support-compat:28.0.0 (*)
| | | +--- android.arch.lifecycle:livedata:1.1.1
| | | | +--- android.arch.core:runtime:1.1.1
| | | | | +--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | | | \--- android.arch.core:common:1.1.1 (*)
| | | | +--- android.arch.lifecycle:livedata-core:1.1.1
| | | | | +--- android.arch.lifecycle:common:1.1.1 (*)
| | | | | +--- android.arch.core:common:1.1.1 (*)
| | | | | \--- android.arch.core:runtime:1.1.1 (*)
| | | | \--- android.arch.core:common:1.1.1 (*)
| | | \--- android.arch.lifecycle:viewmodel:1.1.1
| | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | +--- com.android.support:localbroadcastmanager:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | \--- com.android.support:print:28.0.0
| | \--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-fragment:28.0.0
| | +--- com.android.support:support-compat:28.0.0 (*)
| | +--- com.android.support:support-core-ui:28.0.0
| | | +--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:support-compat:28.0.0 (*)
| | | +--- com.android.support:support-core-utils:28.0.0 (*)
| | | +--- com.android.support:customview:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | \--- com.android.support:support-compat:28.0.0 (*)
| | | +--- com.android.support:viewpager:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:coordinatorlayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:drawerlayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:slidingpanelayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:interpolator:28.0.0
| | | | \--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:swiperefreshlayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:interpolator:28.0.0 (*)
| | | +--- com.android.support:asynclayoutinflater:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | \--- com.android.support:support-compat:28.0.0 (*)
| | | \--- com.android.support:cursoradapter:28.0.0 (*)
| | +--- com.android.support:support-core-utils:28.0.0 (*)
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:loader:28.0.0 (*)
| | \--- android.arch.lifecycle:viewmodel:1.1.1 (*)
| +--- com.android.support:support-vector-drawable:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | \--- com.android.support:support-compat:28.0.0 (*)
| \--- com.android.support:animated-vector-drawable:28.0.0
| +--- com.android.support:support-vector-drawable:28.0.0 (*)
| \--- com.android.support:support-core-ui:28.0.0 (*)
+--- com.android.support.constraint:constraint-layout:1.1.3
| \--- com.android.support.constraint:constraint-layout-solver:1.1.3
\--- com.github.kolyall:utils:1.0.4
+--- net.danlew:android.joda:2.8.2
| \--- joda-time:joda-time:2.8.2
+--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
+--- com.android.support:design:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-utils:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-fragment:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:transition:28.0.0-alpha3
| | +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| | \--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:cardview-v7:28.0.0-alpha3
| | \--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| \--- com.android.support:recyclerview-v7:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| \--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
+--- io.reactivex:rxjava:1.3.0
+--- io.reactivex:rxandroid:1.2.1
\--- javax.annotation:jsr250-api:1.0
(*) - dependencies omitted (listed previously)
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
应用程序.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.github.kolyall:utils:1.0.4'
}
这里是 *.pom 文件 from my lib :
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.kolyall</groupId>
<artifactId>utils</artifactId>
<version>1.0.4</version>
<packaging>aar</packaging>
<name>utils</name>
<description>A wrapper for utils on Android</description>
<url>https://github.com/Kolyall/BaseUtils</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>nickunuchek</id>
<name>Nick Unuchek</name>
<email>kolyall@tut.by</email>
</developer>
</developers>
<scm>
<connection>https://github.com/Kolyall/BaseUtils.git</connection>
<developerConnection>https://github.com/Kolyall/BaseUtils.git</developerConnection>
<url>https://github.com/Kolyall/BaseUtils</url>
</scm>
<dependencies>
<dependency>
<groupId>net.danlew</groupId>
<artifactId>android.joda</artifactId>
<version>2.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>28.0.0-alpha3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>design</artifactId>
<version>28.0.0-alpha3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>1.3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxandroid</artifactId>
<version>1.2.1</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<artifactId>rxjava</artifactId>
<groupId>io.reactivex</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
最佳答案
在 Gradle 5.0 之前,gradle 不支持 IMPROVED_POM_SUPPORT,因此它默认将所有传递依赖项视为 compile。 (不支持非 jar 包装。)
这已在 Gradle 5.0 中修复,其中 IMPROVED_POM_SUPPORT 已成为默认行为。
虽然不是强制的,但是告诉gradle提供的依赖是android archive use是一个很好的做法
implementation 'com.github.kolyall:utils:1.0.4@aar'{
transitive=true
}
同时在 gradle 中声明依赖。注意库版本后的@aar
现在将 gradle 升级到 5.0 或更高版本后,
compileClasspath 输出是
+--- com.google.code.gson:gson:2.8.5
+--- org.apache.commons:commons-lang3:3.8.1
+--- io.reactivex:rxjava:1.1.0
\--- com.github.kolyall:utils:1.0.4
\--- net.danlew:android.joda:2.8.2
\--- joda-time:joda-time:2.8.2
关于java - 为什么将具有运行时范围的库添加到 debugCompileClasspath?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53211119/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
当我使用Bundler时,是否需要在我的Gemfile中将其列为依赖项?毕竟,我的代码中有些地方需要它。例如,当我进行Bundler设置时:require"bundler/setup" 最佳答案 没有。您可以尝试,但首先您必须用鞋带将自己抬离地面。 关于ruby-我需要将Bundler本身添加到Gemfile中吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4758609/
我有一个模型:classItem项目有一个属性“商店”基于存储的值,我希望Item对象对特定方法具有不同的行为。Rails中是否有针对此的通用设计模式?如果方法中没有大的if-else语句,这是如何干净利落地完成的? 最佳答案 通常通过Single-TableInheritance. 关于ruby-on-rails-Rails-子类化模型的设计模式是什么?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.co
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
我正在使用的第三方API的文档状态:"[O]urAPIonlyacceptspaddedBase64encodedstrings."什么是“填充的Base64编码字符串”以及如何在Ruby中生成它们。下面的代码是我第一次尝试创建转换为Base64的JSON格式数据。xa=Base64.encode64(a.to_json) 最佳答案 他们说的padding其实就是Base64本身的一部分。它是末尾的“=”和“==”。Base64将3个字节的数据包编码为4个编码字符。所以如果你的输入数据有长度n和n%3=1=>"=="末尾用于填充n%
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/
为什么4.1%2返回0.0999999999999996?但是4.2%2==0.2。 最佳答案 参见此处:WhatEveryProgrammerShouldKnowAboutFloating-PointArithmetic实数是无限的。计算机使用的位数有限(今天是32位、64位)。因此计算机进行的浮点运算不能代表所有的实数。0.1是这些数字之一。请注意,这不是与Ruby相关的问题,而是与所有编程语言相关的问题,因为它来自计算机表示实数的方式。 关于ruby-为什么4.1%2使用Ruby返