0

I am using Play2 framework with maven using the plugin 'com.google.code.play2-maven-plugin'. Recently I had to add query parameters 'name' and 'properties' to the url so that I can filter my search based on name and properties. So I made changes to my routes config file as

config/routes

POST /search/:name/:properties @controllers.SearchController.search(name:java.util.List[String],properties:java.util.List[String])

SearchController

public Result search(List<String> name,List<String> properties) {
...
}

Before making this change the project had no errors and was building fine. But when I added this to my routes file and try to build the project I am getting the below error:

[ERROR] Failed to execute goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-beta5:routes-compile (default-routes-compile) on project search-manager: Routers compilation failed -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-beta5:routes-compile (default-routes-compile) on project search-manager: Routers compilation failed
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Routers compilation failed
    at com.google.code.play2.plugin.Play2RoutesCompileMojo.internalExecute(Play2RoutesCompileMojo.java:187)
    at com.google.code.play2.plugin.AbstractPlay2Mojo.execute(AbstractPlay2Mojo.java:144)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more

I am not getting what is the issue here. Please help me to resolve this error. Thanks in advance

user3318121
  • 23
  • 1
  • 2
  • 5

1 Answers1

0

Adding

request().getQueryString("name");
request().getQueryString("properties");

to my Controller and changing the config/routes file as

POST /search/ @controllers.SearchController.search()

resolved the issue as per How to get query string parameters in java play framework? I didn't find this in play's documentation.

Community
  • 1
  • 1
user3318121
  • 23
  • 1
  • 2
  • 5