Why can IntelliJ IDEA not resolve Gremlin for its SimpleExample?
I need to make a program that doesn't require intervention / manual steps, so I can't use the gremlin/groovy-shell at time of graph-database demonstration.
How can you make a simple Gremlin-Groovy project?
Cannot resolve symbol 'Gremlin'
Reproduction
Steps
- Select-Click a new project in IntelliJ IDEA
- Fill-in fields and confirm for Gremlin-Project
- Navigate-open
Project Structure(IntelliJ IDEA) - Add libraries to
Project Settings > LibrariesorPlatform Settings > Global Librariescompile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.6.3'compile group: 'org.apache.tinkerpop', name: 'gremlin-driver', version: '3.6.3'- If I don't import these directly, then it will suggest older TinkerPop-2 which we don't plan to evaluate
import com.tinkerpop.blueprints.Graphimport com.tinkerpop.gremlin.groovy.Gremlin
- Copy-paste latest found
Groovy Classes with Gremlinfound- I couldn't find anything newer
- Results:
- Expected: Import for
Gremlinwould be found: automatically or recommending - Actually: No Gremlin found for IntelliJ IDEA to import for Groovy
Cannot resolve symbol 'Gremlin'
- Expected: Import for
Layout
│ SimpleProject.iml
│
├───.idea
│ │ .gitignore
│ │ misc.xml
│ │ modules.xml
│ │ vcs.xml
│ │
│ └───libraries
│ apache_tinkerpop_gremlin_core.xml
│ apache_tinkerpop_gremlin_driver.xml
│ groovy_4_0_2.xml
│
├───lib
│
└───src
SimpleExample.groovy
Code
SimpleProject.groovy
import org.apache.tinkerpop.gremlin.structure.Graph
class SimpleExample {
static {
Gremlin.load()
}
public List exampleMethod() {
Graph g = TinkerGraphFactory.createTinkerGraph()
def results = []
g.v(1).out('knows').fill(results)
return results
}
}
SimpleProject.iml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="corretto-11" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="groovy-4.0.2" level="project" />
<orderEntry type="library" name="tinkerpop.gremlin.groovy" level="application" />
<orderEntry type="library" name="apache.tinkerpop.gremlin.core" level="project" />
<orderEntry type="library" name="apache.tinkerpop.gremlin.driver" level="project" />
</component>
</module>
misc.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="corretto-11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
