-
Notifications
You must be signed in to change notification settings - Fork 428
Description
I have some problems when I need to initialize a project.
In a Gradle project in the dependency :
dependencies {
... other dependencies
implementation "com.example:my-lib:${getVer()}"
}
static def getVer() {
def branchMap = [ "dev":"0.0.1", "uat": "0.0.2","master": "0.0.3"]
for (e in branchMap) {
if (getBranch().trim().startsWith(e.key.trim())) {
return e.getValue().trim()+"-SNAPSHOT"
}
}
return branchMap.get("master").trim() +"-SNAPSHOT"
}
static def getBranch() {
def branch = "git branch --show-current".execute()
branch.waitFor()
return branch.text
}
...
When I initialize the LSP jdtls server, I have errors that dependency from com.example:my-lib was missing.
When I change the getBranch() function to return, for example, "dev", errors do not show up.
One more thing, nothing is wrong with the Java project because that error is not shown in IntelliJ Idea.
here is my config
local config = {
cmd = {
'java',
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true',
'-Dlog.level=ALL',
"-javaagent:".. mason_packages .. "/lombok.jar",
'-Xms1g',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'-jar', launcher_jar,
'-configuration', mason_packages .. "/config_linux",
'-data', workspace_dir,
},
root_dir = project_root_dir,
capabilities = capabilities,
init_options = {
bundles = bundles
},
settings = {
java = {
maven = {
downloadSources = true,
updateSnapshots = true
},
implementationsCodeLens = {
enabled = true,
},
referencesCodeLens = {
enabled = true,
},
references = {
includeDecompiledSources = true,
},
import = {
gradle = {
enabled = true,
version = "8.10.2",
annotationProcevssing = {
enabled = true,
},
wrapper = {
enabled = true,
},
user = {
home = os.getenv("HOME") .. "/.gradle",
}
},
maven = {
enabled= true,
},
},
inlayHints = {
parameterNames = {
enabled = "all", -- literals, all, none
},
},
format = {
enabled = true,
settings = {
url = os.getenv("HOME") .. "/.config/nvim/res/jdtls-style.xml",
profile = "GoogleStyle",
},
},
configuration = {
updateBuildConfiguration = "automatic",
maven = {
userSettings = null
},
},
signatureHelp = {
enabled = true,
description = {
enabled = true,
},
},
contentProvider = { preferred = 'fernflower' },
extendedClientCapabilities = extendedClientCapabilities,
completion = {
favoriteStaticMembers = {
"org.hamcrest.MatcherAssert.assertThat",
"org.hamcrest.Matchers.",
"org.hamcrest.CoreMatchers.",
"org.junit.jupiter.api.Assertions.",
"java.util.Objects.requireNonNull",
"java.util.Objects.requireNonNullElse",
"org.mockito.Mockito.",
},
importOrder = {
"java",
"javax",
"com",
"org"
},
},
sources = {
organizeImports = {
starThreshold = 9999,
staticStarThreshold = 9999,
},
},
codeGeneration = {
toString = {
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
},
useBlocks = true,
},
eclipse = {
downloadSources = true,
}
},
},
}