로 컬 maven 창고 구축 실전

3173 단어 android네트워크
로 컬 maven 창고 구축 실전
1 로 컬 maven 구축
1.1 넥 서 스 를 다운로드 (http://www.sonatype.org/nexus/archived/)
1.2 압축 을 풀 고 / Library / nexus - 2.14.2 - 01
1.3 설정 수정
Nexus 의 설치 디 렉 터 리 에서 / bin / nexus 를 찾 으 면 수정 NEXUS_HOMERUN_AS_USER 두 개의 인 자 는 다음 과 같 습 니 다.
NEXUS_HOME="/Library/nexus-2.14.2-01"

# If specified, the Wrapper will be run as the specified user.

# IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory.

# NOTE - This will set the user which is used to run the Wrapper as well as
#  the JVM and is not useful in situations where a privileged resource or
#  port needs to be allocated prior to the user being changed.
RUN_AS_USER=root

# Application
APP_NAME="nexus"
APP_LONG_NAME="Nexus OSS"

2. 서비스 시작
2.1 sudo su (비밀 번 호 를 입력 하면 루트 사용자 로 전환)
2.2 /Library/nexus-2.14.2-01/bin/nexus start
2.3 브 라 우 저 사용, 열기http://localhost:8081/nexus/
3. 구조물 을 Maven 창고 에 업로드
apply plugin: 'maven'

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "http://localhost:8081/nexus/content/repositories/android/") {
                authentication(userName: "admin", password: "admin123")
            }
            pom.version = "1.0"
            pom.artifactId = "deskcore"
            pom.groupId = "com.le"
        }
    }
}

4 사용 부재
프로젝트 의 루트 디 렉 터 리 gradle. build 파일 에 로 컬 meaven 창 고 를 추가 합 니 다.
buildscript {
    repositories {
        jcenter()
        maven {
            credentials {
                username 'admin'
                password 'admin123'
            }
            url 'http://localhost:8081/nexus/content/repositories/android/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

구체 적 인 module 의 gradle. build 파일 에 의존 도 를 추가 합 니 다.
dependencies {
    compile 'com.le:ucenter-core:1.0'
}

참고 문헌
  • Mac 은 개인 maven 창 고 를 구축 하여 Nexus Responsitory 미 러 를 제공 합 니 다 (http://blog.bihe0832.com/private_maven.html?utm_source=tuicool&utm_medium=referral)
  • 기업 내부 maven 서버 를 구축 하고 Android Studio 를 사용 하여 공공 프로젝트 를 발표 합 니 다 (http://blog.csdn.net/qinxiandiqi/article/details/44458707)
  • 신기 Gradle 구축 (http://jiajixin.cn/2015/08/07/gradle-android/)
  • Maven 사유 창고 구축 (https://pcyan.github.io/2017/04/08/use-nexus-to-create-private-maven-repo/)
  • 좋은 웹페이지 즐겨찾기