jshell-maven-plugin
jshell-maven-plugin copied to clipboard
How to let it known the maven project classpath
When i started with: mvn com.github.johnpoth:jshell-maven-plugin:1.0:run, it can not find the org.springframework.boot namespace with import command auto completion.
Hi @developerworks, it doesn't seem JShell supports that? When adding JARs or modules on the class-path/module path, JShell doesn't seem to resolve anything with auto completion except when coming from the JDK (JFrame etc..). I'd be curious to know if you were able to achieve auto completion when launching JShell manually from the command line with classes not from the JDK ? Thanks!
I found a solution: https://gist.github.com/jianwu/9b36a3c9b47edd9c2304ccbf9ace081b
nice @developerworks ! Does this provide auto completion? The script seems to add the JAR dependencies to JShell's class-path which didn't provide auto completion for me. Thanks!
In my case, the maven project is a springboot project, i imports something like this:
import org.springframework.web.util.*
But it does not provide you auto completion level by level.
jshell> /imports
| import java.io.*
| import java.math.*
| import java.net.*
| import java.nio.file.*
| import java.util.*
| import java.util.concurrent.*
| import java.util.function.*
| import java.util.prefs.*
| import java.util.regex.*
| import java.util.stream.*
| import org.springframework.web.util.*
import is successful.
jshell> import org.
ietf jcp omg w3c xml
there is no springframework when type a TAB key.
Maybe, i need import parent packages. i try it.
I tried, if a package have not any classes, no auto completion. leaf package(or have classes in it) is ok.
jshell> import org.springframework.web.util.
AbstractUriTemplateHandler ContentCachingRequestWrapper ContentCachingResponseWrapper CookieGenerator DefaultUriBuilderFactory
DefaultUriTemplateHandler HtmlUtils HttpSessionMutexListener IntrospectorCleanupListener JavaScriptUtils
NestedServletException ServletContextPropertyUtils TagUtils UriBuilder UriBuilderFactory
UriComponents UriComponentsBuilder UriTemplate UriTemplateHandler UriUtils
UrlPathHelper WebAppRootListener WebUtils
There's a known bug where jshell doesn't tab complete on non-jdk packages
https://bugs.openjdk.java.net/browse/JDK-8177650
Thanks @thinkbigthings for the info! @developerworks don't think we can do much here until the bug is fixed...