Maven 如何在gradle中编写项目信息?

Maven 如何在gradle中编写项目信息?,maven,gradle,build.gradle,gradle-plugin,Maven,Gradle,Build.gradle,Gradle Plugin,我正在将一个示例maven项目转换为Gradle。在maven项目中,有许可证、组织、开发人员等标签。我只想在Gradle项目中给出这些细节。我试图在build.gradle文件中添加以下内容 licenses { license { name = 'Apache 1' url = 'http://www.apache.org/licenses/LICENSE-1.0.txt' distribution = 'repo' c

我正在将一个示例maven项目转换为Gradle。在maven项目中,有许可证、组织、开发人员等标签。我只想在Gradle项目中给出这些细节。我试图在
build.gradle
文件中添加以下内容

licenses {
    license {
        name = 'Apache 1'
        url = 'http://www.apache.org/licenses/LICENSE-1.0.txt'
        distribution = 'repo'
        comments = 'OSS license'
    }
}

organization {
    name = 'Sonatype'
    url = 'http://www.sonatype.com'
}
但它给出了一个错误

> Could not find method licenses() for arguments [build_aa7z0myalt7c30hobty4ylab$_run_closure1@227a2f2] on root project 'simple-weather' of type org.gradle.api.Project.

如何做到同样,我是否要添加一些插件

定制发布到Maven存储库的POM取决于插件

例如:

plugins {
    id 'maven-publish'
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            pom {
                licenses {
                    license {
                        name = 'Apache 1'
                        url = 'http://www.apache.org/licenses/LICENSE-1.0.txt'
                        distribution = 'repo'
                        comments = 'OSS license'
                    }
                }

                organization {
                    name = 'Sonatype'
                    url = 'http://www.sonatype.com'
                }
            }
        }
    }
}