How do I add Groovy scripts to a Java project with classical Maven structure?
I have a Java Maven project with its usual structure. It was generated by Spring Boot project creator.
Now I want to add some Groovy scripts to it, such that
I'm using IntelliJ Idea Community Edition.
What do I need to do (incl. where to put the Groovy scripts) in order to write and execute a Groovy script in the IDE, which can access my Java class com.mycompany.SomeComplexClass
that depends on libraries managed by Maven (encoded in pom.xml
) ?
Made a little repo for this case, started with Spring Boot and just added few things so the Groovy code can be run. Also, tested it with IDEA Community Edition (most recent version, using bundle Maven).
There are two ways you can achieve what you want:
just add one dependency to your pom.xml dependencies section - the dependency on groovy
<!-- added so you can run Groovy scripts from IDEA -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.3.11</version>
<scope>test</scope>
</dependency>
And you should be able to create run configuration for the groovy scripts.
To test this clone this repo and import to IDEA as Maven project.
链接地址: http://www.djcxy.com/p/88572.html上一篇: 如何标记HTML列表的标题