Twirl with maven - Exception in thread "main" java.lang.NoSuchMethodError:

174 Views Asked by At

I have a maven project, simple twirl template and twirl plugin for maven - https://github.com/JakeWharton/twirl-maven-plugin After compiling I tried to print generated result but got an runtime error. Also I have a compile error when use a Scala Collections in this template. There is no such errors when I do it with sbt, but I have to use maven. Could you help me resolve it?

    <plugin>
        <groupId>com.jakewharton.twirl</groupId>
        <artifactId>twirl-maven-plugin</artifactId>
        <version>1.2.0</version>
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

<dependency>
    <groupId>com.typesafe.play</groupId>
    <artifactId>twirl-api_2.12</artifactId>
    <version>1.5.0</version>
</dependency>

Error

Exception in thread "main" java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
    at play.twirl.api.BaseScalaTemplate.<init>(BaseScalaTemplate.scala:12)
    at txt.test$.<init>(test.template.scala:15)
    at txt.test$.<clinit>(test.template.scala)
    at ru.russianpost.dc.AszupGeneratorMain$.main(AszupGeneratorMain.scala:9)
    at ru.russianpost.dc.AszupGeneratorMain.main(AszupGeneratorMain.scala)

/twirl/test.scala.txt

@(customer: String)

@customer

main

println(txt.test("Test"))
0

There are 0 best solutions below