本地 Maven 存储库需要 sudo 才能通过 gradle 解析工件
Local Maven repo requires sudo to resolve artifacts via gradle
我最近从 maven-android-plugin
迁移到基于 Gradle 的 Android 构建系统的 v1.1。在与 hamcrest(和相关的泛型地狱)相关的一些变化之后,我有我的基于 Robolectric 的单元测试 运行ning 在 gradle...但只有当我 运行 使用 sudo
.
测试 gradle 命令时
我得到的错误 运行 类似于 ./gradlew testWithGoogleMapsDebug
的命令
Unable to resolve artifact: Missing:
Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
我检查了本地 .m2
存储库的权限并 chmod -R 777
编辑了存储库的根目录以查看是否有任何影响(没有)。
我怀疑外面有人知道怎么回事,可惜我有点卡住了!
...这是完整的轨迹;
Unable to resolve artifact: Missing:
----------
1) org.ccil.cowan.tagsoup:tagsoup:jar:1.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.ccil.cowan.tagsoup -DartifactId=tagsoup -Dversion=1.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.ccil.cowan.tagsoup -DartifactId=tagsoup -Dversion=1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.ccil.cowan.tagsoup:tagsoup:jar:1.2
2) org.json:json:jar:20080701
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.json -DartifactId=json -Dversion=20080701 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.json -DartifactId=json -Dversion=20080701 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.json:json:jar:20080701
3) org.robolectric:android-all:jar:4.3_r2-robolectric-0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.3_r2-robolectric-0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.3_r2-robolectric-0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.robolectric:android-all:jar:4.3_r2-robolectric-0
----------
...这是已删除敏感信息的应用 build.gradle;
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "21.1.2"
defaultConfig {
// Keep original packaging package path.
applicationId "my.app.id"
minSdkVersion 11
targetSdkVersion 19
versionCode 25
versionName "2.4.0"
multiDexEnabled true
}
sourceSets {
androidTest.setRoot('src/test')
}
signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
// Release signing detail.
}
}
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
pseudoLocalesEnabled true
}
release {
minifyEnabled false
signingConfig signingConfigs.release
}
}
productFlavors {
withGoogleMaps {
// Flavour-based config
}
withOsm {
// Flavour-based config
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
compile project(':viewPagerIndicator')
compile 'com.nineoldandroids:library:2.4.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'joda-time:joda-time:2.7'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.5@aar'
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.guava:guava:18.0'
compile 'com.github.amlcurran.showcaseview:library:5.1.1-SNAPSHOT'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
withGoogleMapsCompile 'com.google.android.gms:play-services-location:7.0.0'
withGoogleMapsCompile 'com.google.android.gms:play-services-maps:7.0.0'
withOsmCompile 'org.osmdroid:osmdroid-android:4.1'
withOsmCompile 'org.osmdroid:osmbonuspack:4.4'
withOsmCompile 'org.slf4j:slf4j-android:1.7.7'
// Test dependencies.
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'org.robolectric:robolectric:2.4'
testCompile('org.mockito:mockito-core:1.9.5') {
exclude group: 'org.hamcrest'
}
testCompile 'junit:junit:4.12'
testCompile 'com.google.guava:guava:18.0'
provided 'com.squareup.dagger:dagger-compiler:1.2.1'
}
configurations {
// Avoid gradle warnings.
all*.exclude module: 'commons-logging'
all*.exclude module: 'httpclient'
}
...我是 运行ning Maven 3.1.1;
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 16:22:22+0100)
Maven home: /Users/me/Dropbox/Maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"
所以... 运行 带有 --info
标志的构建突出显示 gradle 正在尝试在硬盘驱动器的根目录下创建一个 .m2
文件夹。它没有这样做的权限(为什么会这样?!)。
所以,"WTF" 时刻是为什么当 运行 在 gradle 构建下进行单元测试时,它是否需要 另一个 .m2 存储库驱动器的根目录。迷失在那个...
我最近从 maven-android-plugin
迁移到基于 Gradle 的 Android 构建系统的 v1.1。在与 hamcrest(和相关的泛型地狱)相关的一些变化之后,我有我的基于 Robolectric 的单元测试 运行ning 在 gradle...但只有当我 运行 使用 sudo
.
我得到的错误 运行 类似于 ./gradlew testWithGoogleMapsDebug
Unable to resolve artifact: Missing:
Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
我检查了本地 .m2
存储库的权限并 chmod -R 777
编辑了存储库的根目录以查看是否有任何影响(没有)。
我怀疑外面有人知道怎么回事,可惜我有点卡住了!
...这是完整的轨迹;
Unable to resolve artifact: Missing:
----------
1) org.ccil.cowan.tagsoup:tagsoup:jar:1.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.ccil.cowan.tagsoup -DartifactId=tagsoup -Dversion=1.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.ccil.cowan.tagsoup -DartifactId=tagsoup -Dversion=1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.ccil.cowan.tagsoup:tagsoup:jar:1.2
2) org.json:json:jar:20080701
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.json -DartifactId=json -Dversion=20080701 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.json -DartifactId=json -Dversion=20080701 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.json:json:jar:20080701
3) org.robolectric:android-all:jar:4.3_r2-robolectric-0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.3_r2-robolectric-0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.3_r2-robolectric-0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) org.robolectric:android-all:jar:4.3_r2-robolectric-0
----------
...这是已删除敏感信息的应用 build.gradle;
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "21.1.2"
defaultConfig {
// Keep original packaging package path.
applicationId "my.app.id"
minSdkVersion 11
targetSdkVersion 19
versionCode 25
versionName "2.4.0"
multiDexEnabled true
}
sourceSets {
androidTest.setRoot('src/test')
}
signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
// Release signing detail.
}
}
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
pseudoLocalesEnabled true
}
release {
minifyEnabled false
signingConfig signingConfigs.release
}
}
productFlavors {
withGoogleMaps {
// Flavour-based config
}
withOsm {
// Flavour-based config
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
compile project(':viewPagerIndicator')
compile 'com.nineoldandroids:library:2.4.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'joda-time:joda-time:2.7'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.5@aar'
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.guava:guava:18.0'
compile 'com.github.amlcurran.showcaseview:library:5.1.1-SNAPSHOT'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
withGoogleMapsCompile 'com.google.android.gms:play-services-location:7.0.0'
withGoogleMapsCompile 'com.google.android.gms:play-services-maps:7.0.0'
withOsmCompile 'org.osmdroid:osmdroid-android:4.1'
withOsmCompile 'org.osmdroid:osmbonuspack:4.4'
withOsmCompile 'org.slf4j:slf4j-android:1.7.7'
// Test dependencies.
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'org.robolectric:robolectric:2.4'
testCompile('org.mockito:mockito-core:1.9.5') {
exclude group: 'org.hamcrest'
}
testCompile 'junit:junit:4.12'
testCompile 'com.google.guava:guava:18.0'
provided 'com.squareup.dagger:dagger-compiler:1.2.1'
}
configurations {
// Avoid gradle warnings.
all*.exclude module: 'commons-logging'
all*.exclude module: 'httpclient'
}
...我是 运行ning Maven 3.1.1;
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 16:22:22+0100)
Maven home: /Users/me/Dropbox/Maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"
所以... 运行 带有 --info
标志的构建突出显示 gradle 正在尝试在硬盘驱动器的根目录下创建一个 .m2
文件夹。它没有这样做的权限(为什么会这样?!)。
所以,"WTF" 时刻是为什么当 运行 在 gradle 构建下进行单元测试时,它是否需要 另一个 .m2 存储库驱动器的根目录。迷失在那个...