[英]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.