/** * ===================================================== * Gradle Init Script for Nexus Repository * ===================================================== * * 이 파일은 모든 Gradle 프로젝트에 Nexus 설정을 적용합니다. * This file applies Nexus configuration to all Gradle projects. * * 사용 방법 / Usage: * 1. 이 파일을 ~/.gradle/init.gradle 또는 %USERPROFILE%\.gradle\init.gradle 로 복사 * 2. nexusUrl, nexusUsername, nexusPassword를 실제 값으로 변경 * * 또는 프로젝트별로 적용: * gradlew build --init-script init.gradle */ allprojects { repositories { // 기존 저장소 제거 (선택사항) all { ArtifactRepository repo -> if (repo instanceof MavenArtifactRepository) { def url = repo.url.toString() // Maven Central, Google, JCenter 등 외부 저장소 제거 if (url.contains('maven.org') || url.contains('jcenter') || url.contains('google.com')) { remove repo } } } // Nexus Repository 설정 maven { name 'NexusMavenPublic' url 'http://nexus.your-company.com:8081/repository/maven-public/' credentials { username 'your-nexus-username' password 'your-nexus-password' } // HTTP 사용 시 (HTTPS 권장) allowInsecureProtocol = true } // Gradle Plugin Portal용 Nexus 설정 (선택사항) maven { name 'NexusGradlePlugins' url 'http://nexus.your-company.com:8081/repository/gradle-plugins/' credentials { username 'your-nexus-username' password 'your-nexus-password' } allowInsecureProtocol = true } } // Plugin Resolution Strategy buildscript { repositories { maven { name 'NexusMavenPublic' url 'http://nexus.your-company.com:8081/repository/maven-public/' credentials { username 'your-nexus-username' password 'your-nexus-password' } allowInsecureProtocol = true } } } } // Settings for Plugin Management settingsEvaluated { settings -> settings.pluginManagement { repositories { maven { name 'NexusGradlePlugins' url 'http://nexus.your-company.com:8081/repository/gradle-plugins/' credentials { username 'your-nexus-username' password 'your-nexus-password' } allowInsecureProtocol = true } maven { name 'NexusMavenPublic' url 'http://nexus.your-company.com:8081/repository/maven-public/' credentials { username 'your-nexus-username' password 'your-nexus-password' } allowInsecureProtocol = true } } } }