Gradle使用scp和私钥发布到maven存储库
我有一个gradle项目,我想使用带有私钥的SCP将其上传到私有远程maven存储库。如何执行此操作?在Gradle生成文件(build.Gradle)中,添加以下内容:Gradle使用scp和私钥发布到maven存储库,gradle,scp,public-key,maven-publish,Gradle,Scp,Public Key,Maven Publish,我有一个gradle项目,我想使用带有私钥的SCP将其上传到私有远程maven存储库。如何执行此操作?在Gradle生成文件(build.Gradle)中,添加以下内容: apply plugin: 'java' apply plugin: 'maven' // you need this plugin for mavenDeployer support // here you specify how the dependency is going to be retreived // for
apply plugin: 'java'
apply plugin: 'maven' // you need this plugin for mavenDeployer support
// here you specify how the dependency is going to be retreived
// for example:
// compile group: 'co.domain', name: 'library', version: '0.1'
group = 'co.domain'
rootProject.name = 'library'
version = '0.1'
task deployJar(type: Jar)
configurations {
deployerJars
}
dependencies {
deployerJars "org.apache.maven.wagon:wagon-ssh:2.9"
}
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: "scp://<url-of-your-webserver>/<path-to-maven-directory>") {
authentication(userName: "ssh-username", privateKey: "<path-to-private-key-file")
}
}
}
私钥路径可以是这样的:
scp://domain.co/var/www/maven/
/home/users/username/.ssh/id_rsa
有关如何在Gradle中发布工件的更多信息,请参见此处:
然后在这里查看Maven的详细信息:嘿,欧泊,谢谢你纠正我的文字。你能解释一下为什么对我的问题投反对票吗?