简体   繁体   中英

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. In a class I was given a build.gradle that uses the deprecated function compile like this:

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 . 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. So, how can I add the processing core.jar as a local library to my gradle project using the newest gradle? thanks in advance and sorry for any spelling mistakes.

You need to stop using the compile configuration.

Instead you should use implementation for dependency declarations and runtimeClasspath for fat jar packaging.

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) }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM