Play app with dependencies on 3 other play apps

余生颓废 提交于 2020-01-06 04:30:49

问题


I am running a play app, this app has dependencies on 3 other play apps, i.e. the first play app has 3 dependencies in build.sbt.

Now of course all these 4 apps have their own route.conf file.

The thing is when I start the first app, APIs for one of the jars start working instead of the app that i started. What I mean is that all the API urls for the first app is invalid and doesn't open while APIs of one of the jars that I added as a dependency starts working.

Is there a way to stop this from happening and most importantly why is this happening?

Sorry, but the info is not available in the docs or someplace else.

Thanks!


回答1:


You must be sure that the routes are unique.

What I did was to name routes files. To have only one with the name routes.

In this one I revered the other ones:

# Page.
GET        /wizard/:wizard/:user        server.WizardController.wizardPage(wizard: String, user: String)

# Reuse the routes from the ADAPTERS project
->         /                            adapters.Routes

Here is my example: https://github.com/pme123/scala-adapters-wizard

In your case it is the other way around (one routes forwards to the other routes for different sub-paths)

# Page.
->        /app2   app2.Routes   
->        /app3   app3.Routes   
->        /app4   app4.Routes   

# Routes from app1
GET         /doIt                            controller.doIt()
...

And that you run the app you want. Like sbt app1/run. This is necessary if app1 is not the default project - see the documentation.



来源:https://stackoverflow.com/questions/56269552/play-app-with-dependencies-on-3-other-play-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!