简体   繁体   English

Gradle - 使用不同的 java 源/编译版本将特定文件夹添加到 JAR

[英]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.我有一个 Gradle 项目,我想在其中公开请求/响应文件夹以供另一个项目使用。 My project is running in java 11. and its structure is like this我的项目运行在java 11.它的结构是这样的

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?我只想公开 src.main.java.com.xxx.request/response with java 8. 我该怎么做?

below is my NOT working Gradle build下面是我不工作的 Gradle 构建

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.创建一个 muilti_project,将您的请求/响应代码放入 lib 子项目并声明依赖项。

check this and this out.检查这个这个

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

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