O'Reilly logo

Play Framework Cookbook - Second Edition by Giancarlo Inductivo, Alexander Reelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the same model for different applications

For this recipe, we will create a new standalone module that will contain product-related functions and data model classes, and we will publish it on a local repository:

How to do it…

For Java, we need to perform the following steps:

  1. Create a new Play 2 project in the same directory level as foo_java:
        activator new product-contrib play-java
    
  2. Create our default module package inside the app directory, product-contrib/app:
        mkdir app/productcontrib
    
  3. Create the models package, which will contain all the data model classes:
        mkdir app/productcontrib/models
    
  4. Remove the contents of the conf/application.conf file:
        echo "" > conf/application.conf
  5. Remove the contents of the conf/routes file and rename it to productcontrib.routes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required