我正在尝试将一些工件发布到 maven 中央存储库,并且由于当前版本的 gradle(0.9-rc2)不处理 pgp,我想我会在等待 gradle 1.0 时通过“移植”ant xml版本来尝试一下希望能开箱即用地支持它。
我在gradle中写了以下内容:
def mvn =
groovy.xml.NamespaceBuilder.newInstance(ant, 'antlib:org.apache.maven.artifact.ant')
mvn.mvn {
arg(value: 'org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file')
arg(value: '-Durl=file:///tmp/repo2')
arg(value: '-DrepositoryId=sonatype-nexus-staging')
arg(value: '-DpomFile=pom.xml')
arg(value: '-Dfile=myjar.jar')
arg(value: '-Dfile=-Pgpg')
}
不幸的是,它不起作用,我得到了这个:
Cause: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:mvn
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
我尝试了各种组合,包括在脚本顶部添加以下内容:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.maven:maven-ant-tasks:2.1.1'
}
}
任何帮助将非常感激
谢谢颜