Era*_*ise 2 android sonatype gradle android-studio-2.0
我在 AndroidStudio 上工作,我有一个项目的结构:
我的项目1
我想将 ModuleCommon 和 ModuleDemo 上传到我的本地 nexus 服务,我将在其他项目中使用 ModuleCommon 或(和)ModuleSocket,即我的 gradle 脚本(片段):
apply plugin: 'maven'
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}
def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
pom.groupId = GROUP
pom.artifactId = "ModuleCommon"
pom.version = "0.0.1"
repository(url: RELEASE_REPOSITORY_URL) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: SNAPSHOT_REPOSITORY_URL) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
}
}
}
task androidJavadocs(type: Javadoc) {
options.encoding = "UTF-8"
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
}
Run Code Online (Sandbox Code Playgroud)
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('xmrk:rkandroid:0.0.1')
}
Run Code Online (Sandbox Code Playgroud)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
repositories {
maven {url "http://192.168.1.34:8081/nexus/content/repositories/releases"}
maven {url "http://192.168.1.34:8081/nexus/content/repositories/snapshots"}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
repositories {
maven {url "http://localhost:8081/nexus/content/repositories/releases"}
maven {url "http://localhost:8081/nexus/content/repositories/snapshots"}
}
}
}
Run Code Online (Sandbox Code Playgroud)
GROUP=xmrk
SNAPSHOT_REPOSITORY_URL=http://localhost:8081/nexus/content/repositories/snapshots/
RELEASE_REPOSITORY_URL=http://localhost:8081/nexus/content/repositories/releases/
NEXUS_USERNAME=myname
NEXUS_PASSWORD=mypassword
Run Code Online (Sandbox Code Playgroud)
通过上面的脚本,我成功地将库 ModuleCommon 和 ModuleSocket 上传到我的 Nexus 服务器,但是当我使用 ModuleSocket 时,出现错误:
错误:无法解决:xmrk:ModuleCommon:未指定的打开文件
在项目结构对话框中显示
有人救救我吗?我觉得我的情况就像Android Gradle 库依赖项与使用 Nexus 的库依赖项一样,但有一点差异,并且有差异错误。
| 归档时间: |
|
| 查看次数: |
1985 次 |
| 最近记录: |