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
128 stars 53 forks source link

buildDir and compileJava don't work #1413

Open 853103174 opened 1 year ago

853103174 commented 1 year ago

Extension Name: vscode-gradle Extension Version: 3.12.7 OS Version: win10 VSCode version: 1.81.0

Describe the bug build.gradle configuration buildDir and compileJava, but don't

To Reproduce

  1. installed Gradle Extension Pack and Extension Pack for Java
  2. update settings.json
    {
    "java.help.collectErrorLog": true,
    "gradle.debug": true,
    "gradle.disableConfirmations": true,
    "gradle.javaDebug.cleanOutput": true,
    "gradle.projectOpenBehaviour": "Open",
    "gradle.showStoppedDaemons": true,
    "java.codeGeneration.hashCodeEquals.useInstanceof": true,
    "java.codeGeneration.hashCodeEquals.useJava7Objects": true,
    "java.codeGeneration.insertionLocation": "lastMember",
    "java.codeGeneration.toString.codeStyle": "STRING_BUILDER_CHAINED",
    "java.codeGeneration.toString.skipNullValues": true,
    "java.codeGeneration.useBlocks": true,
    "java.configuration.maven.globalSettings": "D:\\apache-maven-3.6.3\\conf\\settings.xml",
    "java.configuration.maven.userSettings": "D:\\apache-maven-3.6.3\\conf\\settings.xml",
    "maven.settingsFile": "D:\\apache-maven-3.6.3\\conf\\settings.xml",
    "java.import.gradle.wrapper.enabled": false,
    "java.jdt.ls.androidSupport.enabled": "off",
    "java.debug.settings.showQualifiedNames": true,
    "java.debug.settings.showStaticVariables": true,
    "maven.executable.preferMavenWrapper": false,
    "maven.pomfile.autoUpdateEffectivePOM": true,
    "maven.pomfile.prefetchEffectivePom": true,
    "java.import.gradle.user.home": "D:\\gradle-repository",
    "java.debug.logLevel": "verbose",
    "spring.initializr.defaultOpenProjectMethod": "Open",
    "gradle.javaDebug": {
        "tasks": [
            "run",
            "runBoot",
            "test",
            "intTest",
            "integration"
        ]
    },
    "java.compile.nullAnalysis.nonnull": [
        "javax.annotation.Nonnull",
        "org.eclipse.jdt.annotation.NonNull",
        "org.springframework.lang.NonNull"
    ],
    "java.configuration.updateBuildConfiguration": "disabled",
    "java.compile.nullAnalysis.mode": "disabled",
    "java.import.gradle.home": "D:\\gradle-8.3",
    "java.saveActions.organizeImports": true,
    "java.typeHierarchy.lazyLoad": true,
    "java.implementationsCodeLens.enabled": true,
    "java.inlayHints.parameterNames.enabled": "none",
    "tabnine.experimentalAutoImports": true,
    "terminal.explorerKind": "external",
    "terminal.integrated.defaultProfile.windows": "Windows PowerShell",
    "terminal.external.windowsExec": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.persistentSessionReviveProcess": "never",
    "terminal.integrated.tabs.focusMode": "singleClick",
    "java.maven.downloadSources": true,
    "java.eclipse.downloadSources": true,
    "boot-java.rewrite.reconcile": true,
    "redhat.telemetry.enabled": false,
    "java.home": "D:\\dragonwell-17",
    "java.jdt.ls.java.home": "D:\\dragonwell-17",
    "java.import.gradle.java.home": "D:\\dragonwell-17",
    "maven.terminal.useJavaHome": true,
    "boot-java.validation.java.boot2": "ON",
    "boot-java.change-detection.on": true,
    "boot-java.validation.java.boot3": "ON",
    "search.useParentIgnoreFiles": true,
    "java.debug.settings.console": "internalConsole",
    "java.maven.updateSnapshots": true,
    "java.referencesCodeLens.enabled": true,
    "files.defaultLanguage": "UTF-8",
    "java.project.encoding": "setDefault",
    "java.project.importHint": false,
    "maven.projectOpenBehavior": "Open",
    "spring-boot.ls.java.home": "D:\\dragonwell-17",
    "java.dependency.packagePresentation": "hierarchical",
    "java.dependency.showMembers": true,
    "java.import.maven.disableTestClasspathFlag": true,
    "java.completion.favoriteStaticMembers": [
        "org.junit.Assert.*",
        "org.junit.Assume.*",
        "org.junit.jupiter.api.Assertions.*",
        "org.junit.jupiter.api.Assumptions.*",
        "org.junit.jupiter.api.DynamicContainer.*",
        "org.junit.jupiter.api.DynamicTest.*",
        "org.mockito.Mockito.*",
        "org.mockito.ArgumentMatchers.*",
        "org.mockito.Answers.*"
    ],
    "java.debug.settings.forceBuildBeforeLaunch": false,
    "gradle.focusTaskInExplorer": false,
    "java.completion.chain.enabled": true,
    "java.completion.guessMethodArguments": "insertBestGuessedArguments",
    "java.import.generatesMetadataFilesAtProjectRoot": false,
    "[java]": {
        "editor.defaultFormatter": "redhat.java"
    }
    }

    maven, java17, gradle8.3 are local installation directories

  3. clone project by https://github.com/853103174/cqrs-tpl
  4. Execute SQL on mysql
    CREATE DATABASE IF NOT EXISTS `fresh-test`;
    USE `fresh-test`;
    CREATE TABLE IF NOT EXISTS `area` (
    `code` mediumint(8) unsigned NOT NULL COMMENT '编码',
    `name` varchar(10) DEFAULT NULL COMMENT '名称',
    `parent_code` mediumint(8) unsigned DEFAULT NULL COMMENT '父编码(0:省 其他:市县)',
    `full_name` varchar(20) DEFAULT NULL COMMENT '完整名称',
    `type` tinyint(1) unsigned DEFAULT NULL COMMENT '类型(1:省 2:市 3:县)',
    `lon` decimal(9,6) DEFAULT NULL COMMENT '经度',
    `lat` decimal(8,6) DEFAULT NULL COMMENT '纬度',
    `sort` tinyint(3) unsigned DEFAULT NULL COMMENT '排序',
    `weather_code` int(10) unsigned DEFAULT NULL COMMENT '天气网编码',
    PRIMARY KEY (`code`) USING BTREE
    ) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 COMMENT='行政区划表';
  5. set jdbcUrl,username,password and host on cqrs-tpl\trade-hall\src\main\resources\dev\application.yml
  6. run with cqrs-tpl\trade-hall\src\main\java\com\sdnc\trade\TradeHallApplication.java
  7. Send get request: http://127.0.0.1:8811/qry/area/list?parentCode=0&name=%E5%B1%B1%E5%8C%97&pageNum=1&pageSize=10
  8. Correct content output from the console ┏━━━━━ Debug [area.list] ━━━ ┣ SQL: select * from area WHERE parent_code=? and name like concat('%',?,'%') ┣ 参数: [0, 山北] ┣ 位置: jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2) ┣ 时间: 2ms ┣ 结果: [0] ┗━━━━━ Debug [area.list] ━━━

Expected behavior The build folder of the project is target Java8 compilation -parameter parameters are in effect

Screenshots If applicable, add screenshots to help explain your problem.

Output from "Gradle for Java" [debug] [gradle-server] Starting server [debug] [gradle-server] Gradle Server cmd: c:\Users\Administrator.vscode\extensions\vscjava.vscode-gradle-3.12.7\lib\gradle-server.bat 56950 [info] [gradle-server] Server started, listening on 56950 [info] Gradle client connected to server [debug] Refreshing tasks [info] Java Home: D:\dragonwell-17 [info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant [info] Gradle User Home: D:\gradle-repository [info] Gradle Version: 8.3 [info] Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

CONFIGURE SUCCESSFUL in 15s [info] Found 187 tasks

Does the bug still exist if you disable all other extensions? Yes

Additional context Add any other context about the problem here.

jdneo commented 1 year ago

So it's about two problem:

  1. compiled .class files are not generated to build folder
  2. -parameter parameters are not applied to compiled .class files

Am I right?

ArchonLita commented 9 months ago

https://stackoverflow.com/a/73328432

If you are straight up running the project using java language support, this may help