microsoft / vscode-gradle

Manage Gradle Projects, run Gradle tasks and provide better Gradle file authoring experience in VS Code
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle
MIT License
122 stars 49 forks source link

support compileJava tasks #1399

Open 853103174 opened 1 year ago

853103174 commented 1 year ago

Is your feature request related to a problem? Please describe. When building a multi-module project which includes a module outside of the springboot project, support compileJava tasks

Describe the solution you'd like in springboot3, There are the following configurations build.gradle, and an error message will also be prompted. [WARN] 15:57:08 Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.sdnc.trade.interfaces.controller.area.AreaQryExe

compileJava { options.fork = true options.incremental = true options.failOnError = false options.deprecation = true options.compilerArgs += ['-parameters', '-Xdoclint:none', '-Xlint:none', '-nowarn'] }

Additional context In the following configuration, IntelliJ IDEA can successfully parse the compileJava task

plugins { id 'java' id 'application' id 'org.springframework.boot' version '3.1.3' id 'io.spring.dependency-management' version '1.1.3' }

//配置统一信息,包括root项目 allprojects { group = 'com.sdnc' version = '1.0.0'

repositories {
    mavenLocal()
    mavenCentral()
    maven { url 'https://maven.aliyun.com/repository/public' }
    maven { url 'https://app.camunda.com/nexus/content/groups/public' }
    maven { url 'https://maven.alfresco.com/nexus/content/groups/public' }
    maven { url 'https://jitpack.io' }
}

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

}

configurations { developmentOnly runtimeClasspath { extendsFrom developmentOnly } compileOnly { extendsFrom annotationProcessor } }

//配置共用的资源库信息 subprojects { apply plugin: 'java' apply plugin: 'application' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management'

//配置JVM参数
// application {
//     applicationDefaultJvmArgs = ['--enable-parameters']
// }

//根据命令加载不同的配置文件
def env = System.getProperty("file") ?: "dev"
sourceSets {
    main {
        java {
            srcDirs = ["src/main/java"]
        }
        resources {
            srcDirs = ["src/main/resources/$env", "src/main/java"]
        }
    }
}

compileJava {
    options.fork = true
    options.incremental = true
    options.failOnError = true
    options.deprecation = true
    options.compilerArgs += ['-parameters', '-Xdoclint:none', '-Xlint:none', '-nowarn']
}

configurations {
    all*.exclude module: 'spring-boot-starter-logging'
    all*.exclude module: 'spring-boot-starter-tomcat'
    all*.exclude module: 'spring-boot-starter-json'
    all*.exclude module: 'undertow-websockets-jsr'
    all*.exclude module: 'logging-interceptor'
    all*.exclude module: 'kotlin-stdlib-jdk8'
    all*.exclude module: 'kotlin-stdlib-jdk7'
    all*.exclude module: 'commons-logging'
    all*.exclude module: 'jboss-logging'
    all*.exclude module: 'lettuce-core'
    all*.exclude module: 'slf4j-api'
    all*.exclude module: 'HikariCP'
    all*.exclude module: 'sql-gen'
    all*.exclude module: 'json'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-aop'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-undertow'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'com.tencentcloudapi:tencentcloud-sdk-java-sms:3.1.830'
    implementation 'com.ibeetl:sql-springboot-starter:3.25.1-RELEASE'
    implementation 'com.ibeetl:sql-accelerator:3.25.1-RELEASE'
    implementation 'com.ibeetl:sql-firewall:3.25.1-RELEASE'
    implementation 'com.ibeetl:sql-xml:3.25.1-RELEASE'
    implementation 'com.github.f4b6a3:ulid-creator:5.2.1'
    implementation 'com.github.chris2018998:beecp:3.4.2'
    implementation 'com.gitee.853103174:tinylog:3.4.6'
    implementation 'org.hashids:hashids:1.0.3'
    implementation 'org.noear:snack3:3.2.75'
    implementation 'redis.clients:jedis'
    compileOnly 'io.github.linpeilie:mapstruct-plus-spring-boot-starter:1.3.5'
    compileOnly 'org.projectlombok:lombok:1.18.28'
    runtimeOnly 'com.mysql:mysql-connector-j'
    annotationProcessor 'org.projectlombok:lombok:1.18.28'
    annotationProcessor 'io.github.linpeilie:mapstruct-plus-processor:1.3.5'
    annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
}

}

ArchonLita commented 7 months ago

If you are running the project directly from spring dashboard, this might fix your issue. https://stackoverflow.com/a/73328432