我创建了一个 jwebassembly-gradle 构建,我已经将 jar、source jar 和 javadoc jar 文件复制到我的项目目录结构中名为“libs”的子目录中。我正在使用 Gradle 6.8.2。我收到错误:
“在以下任何来源中都找不到插件 [id: ‘jwebassembly-gradle’]:”
我该如何解决这个问题?我所做的所有搜索都表明这应该有效。目录结构类似于:
Project
- .gradle
- src
- build
- libs
build.gradle文件:
// this handles the actual build script (build.gradle) dependencies!
buildscript {
repositories {
flatDir {
// to use local builds
dirs 'libs'
}
}
dependencies {
classpath fileTree(include: ['*.jar'], dir: 'libs')
classpath files('libs/jwebassembly-gradle-0.4.jar')
classpath files('libs/jwebassembly-gradle-0.4-sources.jar')
classpath files('libs/jwebassembly-gradle-0.4-javadoc.jar')
}
}
plugins {
id 'java'
id 'application'
id 'jwebassembly-gradle'
}
repositories {
flatDir {
// to use local builds
dirs 'libs'
}
mavenCentral()
}
jar {
manifest {
attributes(
"Specification-Title" : "",
"Specification-Version" : project.version,
"Specification-Vendor" : "",
"Implementation-Title" : project.group,
"Implementation-Version" : project.version,
"Implementation-Vendor" : "",
"Main-Class" : "com.myproject.UrlImageGrabber"
)
}
}
dependencies {
classpath fileTree(include: ['*.jar'], dir: 'libs')
classpath files('libs/jwebassembly-gradle-0.4.jar')
classpath files('libs/jwebassembly-gradle-0.4-sources.jar')
classpath files('libs/jwebassembly-gradle-0.4-javadoc.jar')
// other dependencies ..
}
task sourcesJar(type: Jar) {
archiveBaseName=artifactBaseName
classifier 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveBaseName=artifactBaseName
classifier 'javadoc'
from javadoc.destinationDir
}
task(debug, dependsOn: 'classes', type: JavaExec) {
main = mainClassName
classpath = sourceSets.main.runtimeClasspath
args ''
debug true
}
//task webAssembly() {
//
//}
build {
doLast {
// webAssembly()
}
}
artifacts {
archives sourcesJar
archives javadocJar
}
我尝试了各种形式的尝试将 jar 文件包含在 build.gradle 文件的 buildscript 部分中。我仍然收到错误消息。
我认为你不能在本地插件中使用插件 ID 语法。此语法仅适用于 Gradle 插件数据库。
改用应用语法:
apply plugin: 'de.inetsoftware.jwebassembly'