Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a Maven metadata file where you enable Groovy usage and pull all the dependencies. Right click on the 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
    languagexml
    linenumberstrue
    collapsetrue
    <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.3-groovy-2.4</spock.version>
    
            <!-- maven -->
            <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
            <maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
    
            <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>
                        <release>11</release>
                        <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.9.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>addTestSources</goal>
                                <goal>compileTests</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <testSources>
                            <testSource>
                                <directory>${basedir}/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>


  2. Reopen the project and choose "Add as Maven project" when  when prompted.
  3. Make sure you marked the CalculationLogicTest folder as Test Sources Root in IDEA. This should be done by default during the action Upgrade Studio Project Libraries.