Closed kinowarrior closed 3 years ago
Hmm, in the help docs it states:
Set classpath using the following variable:
g:JavaComplete_LibsPath - path of you jar files. This path will
always appended with '~/.m2/repository' directory. Here you can
add your glassfish libs directory or your project libs. It will
be automatically appended with you jre home path.
Does this mean I should manually add jars (even if they are maven dependencies that live inside '~/.m2/repository') ?
Here is the output of:
:echo g:JavaComplete_LibsPath
.: ~/workspace-spring-tool-suite-4-4.4.0.RELEASE/mobile-app-ws/target/classes: ~/workspace-spring-tool-suite-4-4.4.0.RELEASE/mobile-app-ws/target/classes: ~/workspace-spring-tool-suite-4-4.4.0.RELEASE/mobile-app-ws/target/test-classes: ~/workspace-spring-tool-suite-4-4.4.0.RELEASE/mobile-app-ws/target/test-classes: ~/workspace-spring-tool-suite-4-4.4.0.RELEASE/mobile-app-ws/target/classes
So it is not picking up any maven dependencies by default. Is that expected behaviour?
Have explicitly set:
let g:JavaComplete_MavenRepositoryDisable = 0
Bump. Hi, any thoughts?
It seems that no dependencies inside '~/.m2/repository' are picked up. How would I (succinctly) register all my project maven dependencies on classpath?
Hi. What you have in your pom.xml?
Not same person, but I have same problem. My pom looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>myartifactid</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I'm using windows 10
Would be nice to have little project that I can run to reproduce this problem. Can you create it?
Sure. https://github.com/arvyy/javacomplete2_pom_example
None of spring classes are suggested when using f5
I cannot reproduce issues.
Can you show logs of server startup?
You need to run:
:JCdebugEnableLogs
:JCserverTerminate
:JCserverStart
:JCdebugGetLogContent
33.274403 [util] running command: 'java -cp C:\Users\Arvydas\vimfiles\bundle\vim-javacomplete2\libs\javavi\target\classes;C:\Users\Arvydas\vimfiles\bundle\vim-javacomplete2\libs\javaparser-core-3.5.20.jar;C:\Users\Arvydas\vimfiles\bundle\vim-javacomplete2\libs\javavi_log4j-api.jar;C:\Users\Arvydas\vimfiles\bundle\vim-javacomplete2\libs\javavi_log4j-core.jar; kg.ash.javavi.Javavi -version'
33.277606 [server] executing python file: C:\Users\Arvydas\vimfiles\bundle\vim-javacomplete2\autoload\javavibridge.py
33.300515 [server] server classpath: -cp C:\\Users\\Arvydas\\vimfiles\\bundle\\vim-javacomplete2\\libs\\javavi\\target\\classes;C:\\Users\\Arvydas\\vimfiles\\bundle\\vim-javacomplete2\\libs\\javaparser-core-3.5.20.jar;C:\\Users\\Arvydas\\vimfiles\\bundle\\vim-javacomplete2\\libs\\javavi_log4j-api.jar;C:\\Users\\Arvydas\\vimfiles\\bundle\\vim-javacomplete2\\libs\\javavi_log4j-core.jar;.;C:/Users/Arvydas/workspace/javacomplete-test/src/main/java/test/target/classes;C:/Users/Arvydas/workspace/javacomplete-test/src/main/java/test/target/classes;C:/Users/Arvydas/workspace/javacomplete-test/src/main/java/test/target/test-classes;C:/Users/Arvydas/workspace/javacomplete-test/src/main/java/test/target/test-classes;C:/Users/Arvydas/workspace/javacomplete-test/src/main/java/test/target/classes;C:\\Program Files\\Java\\jdk1.8.0_144\\lib
33.300547 [server] server arguments:-Dlog.level=debug -Dlog.directory=C:\Users\Arvydas\vim_javacomplete2_logs -Ddaemon.port=57993 -Dlog4j.configurationFile=C:\Users\Arvydas\vimfiles\bundle\vim-javacomplete2\libs\javavi\target\classes\log4j2.xml kg.ash.javavi.Javavi -sources -base C:\Users\Arvydas\.cache\javacomplete2\ -compiler javac
Can you run this command from project directory:
mvn -B --file pom.xml help:effective-pom dependency:build-classpath -DincludeScope=test
hmm are you interested in the "effective pom" part, because it's ~5000 lines, or only the classpath output
So you have error on this command?
No, it's just that the resulting pom is super long. To avoid further confusion I'll just paste it then: https://pastebin.com/F9Ty8LSi
Can you try to remove effective pom
part in this place: /autoload/javacomplete/classpath/maven.vim:30
?
And try again.
Or just try last version, I just pulled this change in master.
hmm it didn't work. It feels abit unproductive if you can't reproduce. When I have more time I'll try to learn abit about the vimscript and try to debug it myself
If you steel don't see spring libs in output of this command :echo g:JavaComplete_LibsPath
this mean, you should debug this file /javacomplete/classpath/maven.vim
to find out why in your enviroment this doesn't work.
I will be glad to your participation in this issue.
I got same problem. JavaComplete-Imports-Add not work. same response: classname 'OkHttpClient' not found in any scope. it may the problem. i used neovim same. (NVIM v0.4.3)
something else, i notice that :
without JavaComplete-Imports-Add, when i finished that third class.
it shows this : class : Class
last, once more. neovim too. may the problem. I am new one. it may be wrong. bad english. sry
Try using gradle.
I tested the same project with both. Gradle works. Maven doesn't.
Newbie question, most likely relates to classpath setup?
Have a simple SpringBoot application (using maven build):
When I run any of my auto-import shortcuts, it fails to understand the "symbol" under the cursor.
Actual behavior (Required!)
I want to auto-import @PathVariable
Receive an error message:
Expected behavior (Required!)
It auto-imports the PathVariable annotation for me.
Effectively, adds:
Environment (Required!)
This plugin is working, and highlighting the line that is missing the import with message:
I am just unclear how I tell the plugin how to find the maven dependencies for this project (app).
As a workaround, I also have the same app open in an IDE, and can use the autofix there to handle any missing imports. Be much easier if I could just leverage this plugin & stay 100% in VIM.
Please can you offer any advice. Thanks in advance.