简体   繁体   中英

Gradle - Add specific folder to JAR with different java source/compile version

I have a Gradle project where I want to expose the request/response folder out for another project to consume. My project is running in java 11. and its structure is like this

src
  main
    java
      com.xxx
        request
        response
        service
        controller

I only want to expose src.main.java.com.xxx.request/response with java 8. How should I do that?

below is my NOT working Gradle build

task generateJar(type: Jar) {
    manifest {
        attributes("Implementation-Title": "Gradle", "Implementation-Version": "0.0.1")
    }
    from('src/main/java') {
        include '**/request/**'
        include '**/response/**'
    }
}

create a muilti_project, put your request/response code into to a lib subproject and declare the dependencies.

check this and this out.

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