Gradle:未找到Meecrowave插件

时间:2019-02-13 10:02:02

标签: gradle meecrowave

我正在尝试根据此documentation配置meecrowave gradle插件:

这是我的脚本:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.apache.meecrowave:meecrowave-gradle-plugin:1.2.6"
    }
}

plugins {
    id 'java'
    id 'org.apache.meecrowave.meecrowave'
}

meecrowave {
    httpPort = 9090
}

我收到此错误消息:

Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-5.0-bin.zip'.
Build file '/home/jcabre/projectes/digital/espaidoc/security/build.gradle' line: 12
Plugin [id: 'org.apache.meecrowave.meecrowave'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
Plugin [id: 'org.apache.meecrowave.meecrowave'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)

我也尝试过:´

plugins {
  id 'java'
  id 'org.apache.meecrowave.meecrowave' version '1.2.6'
}

然后我收到此消息:

Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-5.0-bin.zip'.
Build file '/home/jcabre/projectes/digital/espaidoc/security/build.gradle' line: 12
Plugin [id: 'org.apache.meecrowave.meecrowave', version: '1.2.6'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.apache.meecrowave.meecrowave:org.apache.meecrowave.meecrowave.gradle.plugin:1.2.6')
  Searched in the following repositories:
    Gradle Central Plugin Repository
Plugin [id: 'org.apache.meecrowave.meecrowave', version: '1.2.6'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.apache.meecrowave.meecrowave:org.apache.meecrowave.meecrowave.gradle.plugin:1.2.6')
  Searched in the following repositories:
    Gradle Central Plugin Repository

父辈

plugins {
    id "base"
    id 'com.github.spotbugs' version '1.6.8' apply false
    id 'io.franzbecker.gradle-lombok' version '2.0' apply false
    id 'fish.payara.micro-gradle-plugin' version '1.0.0' apply false
}

apply from: "$projectDir/gradle/java.gradle"
apply from: "$projectDir/gradle/spotbugs.gradle"
apply from: "$projectDir/gradle/checkstyle.gradle"
apply from: "$projectDir/gradle/pmd.gradle"
apply from: "$projectDir/gradle/jacoco.gradle"
apply from: "$projectDir/gradle/repositories.gradle"
apply from: "$projectDir/gradle/payara.gradle"

2 个答案:

答案 0 :(得分:2)

问题在于此插件未发布到官方Gradle plugins portail,因此您无法使用plugins {} DSL(或者您需要配置pluginManagement.resolutionStrategy,请参见enter link description here

另一个问题是您提到的documentation不是最新的! 插件ID已更改为org.apache.microwave.microwave

应用此插件的最简单方法:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.apache.meecrowave:meecrowave-gradle-plugin:1.2.6"
    }
}

// use "new" plugin ID
apply plugin: "org.apache.microwave.microwave"

// or use directly PLugin class
//apply plugin: org.apache.meecrowave.gradle.MeecrowavePlugin

编辑,请参阅Romain的答案以获取有关此问题的更准确的详细信息。

答案 1 :(得分:1)

只是为了让您知道插件ID问题不是“重命名”而是被遗忘的重命名(在加入openwebbeans项目之前,meecrowave最初被命名为Microwave)。

我修复了https://issues.apache.org/jira/browse/MEECROWAVE-186中的插件ID,并更新了文档以反映这一点。请注意,该文档不在源文件中,而是在线http://openwebbeans.apache.org/meecrowave/meecrowave-gradle/index.html上。

罗曼