...
Create a Maven metadata file where you enable Groovy usage and pull all the dependencies. In Right click on the root folder of your project, create project root folder in Studio and choose New → Create pom.xml from the menu. Or alternatively create the pom.xml file manually in the root folder of your project, looking like this one (substitute "myproject" with you project name).
Code Block language xml linenumbers true collapse true <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>net.pricefx.myproject</groupId> <artifactId>myproject-logic</artifactId> <version>1.0-SNAPSHOT</version> <name>Price f(x) MyProject Logic</name> <properties> <!-- testing --> <junit.version>4.12</junit.version> <spock.version>1.1-groovy-2.4</spock.version> <!-- maven --> <maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version> <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version> <source.jdk>1.8</source.jdk> <target.jdk>1.8</target.jdk> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <testSourceDirectory>tdd4c</testSourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>${target.jdk}</source> <target>${target.jdk}</target> <forceJavacCompilerUse>true</forceJavacCompilerUse> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.5</version> <executions> <execution> <goals> <goal>addTestSources</goal> <goal>testCompile</goal> </goals> </execution> </executions> <configuration> <testSources> <testSource> <directory>${basedir}/tdd4c<CalculationLogicTest</directory> <includes> <include>**/*.groovy</include> </includes> </testSource> </testSources> </configuration> </plugin> </plugins> </build> <dependencies> <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>${spock.version}</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>net.pricefx</groupId> <artifactId>tdd4c</artifactId> <version>1.0-SNAPSHOT</version> <scope>test</scope> </dependency> </dependencies> <repositories> <repository> <id>Default repo</id> <url>http://repo1.maven.org/maven2</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>Pricefx public maven artifacts</id> <url>https://nexus.pricefx.net/tools</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> </repositories> </project>
- Create the tdd4c folder in the project's root directory.
- Mark it as the test sources root in you favourite IDE. Reopen the project and choose "Add as Maven project" when prompted.
- Make sure you marked the CalculationLogicTest folder as Test Sources Root in IDEA. This should be done by default during the action Update Project Libraries.