内网的私服仓库安装请自行百度,这里只介绍一下Gradle发布私服仓库时的Gradle配置

build.gradle

引入插件

apply plugin: 'maven-publish'

配置发布URL与账号密码

task sourceJar(type: Jar) {
	from sourceSets.main.allJava
}

publishing {
	publications {
		mavenJava(MavenPublication) {
			from components.java

			artifact sourceJar {
				classifier "sources"
			}
		}
	}
		
	repositories {
		maven {
			def releasesRepoUrl = "http://192.168.51.234:8081/repository/maven-releases/"
			def snapshotsRepoUrl = "http://192.168.51.234:8081/repository/maven-snapshots/"
			url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
			credentials {
				username = "admin"
				password = "admin123"
			}
		}
    }
}

Nexus的默认账号admin,默认密码admin123

转载请注明原地址: http://blog.noark.xyz/article/2018/9/11/gradle发布私服仓库/