简体   繁体   English

如何将处理 core.jar 添加到 gradle 项目?

[英]How can I add the processing core.jar to a gradle project?

So, I'm trying to make a project using processing, and I intend to use gradle because I like how it simplifies the compiling of the process.所以,我正在尝试使用处理来制作一个项目,我打算使用 gradle,因为我喜欢它如何简化过程的编译。 In a class I was given a build.gradle that uses the deprecated function compile like this:在一个类中,我得到了一个 build.gradle,它使用了不推荐使用的函数 compile ,如下所示:

dependencies {
    // Dependency on local binaries
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

jar {
    manifest {
        attributes "Main-Class": mainClassName
    }

    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

when I run this code, I get a warning from gradle telling me that this build is using some features that will be discontinued in gradle 7.0, I have confirmed that this features are the compile section of the build.gradle .当我运行这段代码时,我收到 gradle 的警告,告诉我这个构建正在使用一些将在 gradle 7.0 中停止的功能,我已经确认这些功能是 build.gradle 的编译部分。 So, I've been trying to include the processing core.jar in gradle using the newer functions of gradle, but i have been unable to succeed.因此,我一直在尝试使用 gradle 的较新功能将处理 core.jar 包含在 gradle 中,但我一直无法成功。 So, how can I add the processing core.jar as a local library to my gradle project using the newest gradle?那么,如何使用最新的 gradle 将处理 core.jar 作为本地库添加到我的 gradle 项目中? thanks in advance and sorry for any spelling mistakes.提前致谢,并对任何拼写错误表示抱歉。

You need to stop using the compile configuration.您需要停止使用compile配置。

Instead you should use implementation for dependency declarations and runtimeClasspath for fat jar packaging.相反,您应该使用依赖声明的implementation和胖 jar 打包的runtimeClasspath

Your example adapted:你的例子改编:

dependencies {
    // Dependency on local binaries
    implementation fileTree(dir: 'libs', include: ['*.jar'])
}

jar {
    manifest {
        attributes "Main-Class": mainClassName
    }

    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Gradle将jar文件添加到libgdx项目 - How can I add jar files to a libgdx project with Gradle 在zxing core.jar文件中找不到MultiFormatReader类 - Can't find MultiFormatReader class in zxing core.jar file 如何将项目作为JAR添加为另一个项目的依赖项? (摇篮) - How do I add a project as JAR as a dependency of another project? (Gradle) 如何在我的 gradle 项目中创建单个可执行文件 jar - How can I create single executable jar in my gradle project Core.jar不在Zxing Core文件夹中吗? -Zxing条码扫描器 - Core.jar not in Zxing Core folder? - Zxing Barcode Scanner 如何将JAR文件添加到现有gradle项目? - How to add a JAR file to an existing gradle project? GlassFish 服务器 core.jar 未包含在已安装包的列表中 - GlassFish server core.jar is not contained in the list of the installed bundles 如何在我的项目中添加gradle-api库? - How can I add gradle-api library to my project? 如何在Gradle项目中使用IntelliJ IDEA生成包含javadoc的.jar? - How can I generate a .jar that also includes javadoc in it using IntelliJ IDEA in a Gradle project? 如何将Gradle项目编译为可以在Android应用程序中使用的jar文件 - How to compile gradle project to a jar file I can use in my Android application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM