I am using IntelliJ IDE for the development and started the project using Play 2.x framework instead of activator:
Now I want to deploy this project to EC2-Ubuntu but to do that everyone is suggesting to install the Typesafe activator which will not work in my case.
I tried to follow the official documentation but they are also redirecting to download "play with activator". Is there any other way to deploy it instead of converting the whole project to typesafe activator?
The play has a deployment system , you need to read the documentation to prepare the project in the right way , but basically you had used the command:
`activator dist
unzip file in target/universal/file.zip
`file.sh in bin folder
`Deploy documentation
Related
I've build a RESTFul Service with Play 2.4 Scala2.11, now I want to deploy this to IBM Bluemix.
play2-war-plugin was used to package the project to a war package since Bluemix use Liberty as container.
But when I push the war package to Bluemix, I got error logs:
[ERROR ] SRVE0918E: The attempted blocking write is not allowed because the non-blocking I/O has already been started by the application registering the WriteListener [play.core.server.servlet31.Play2Servlet31RequestHandler$ResultWriteListener#d2487ee8].
I want to knwo:
Can Scala based PlayFramework project be deployed to IBM Bluemix?
Are there some better ways to package Play project to a war package?
In my circumstances, what can I do to confirm whether this ERROR caused by my codes or caused by the play2-war-plugin.
You don't need to package your Play Framework application in a war file in order to deploy it to Bluemix.
Simply build your application using play dist or activator dist and then use the java_buildpack to deploy it. For example:
$ cf push play-application -p target/universal/play-application-1.0-SNAPSHOT.zip -b java_buildpack
You can see Java buildpack documentation for Play Framework here:
https://github.com/cloudfoundry/java-buildpack/blob/master/docs/example-play_framework.md
Just for people (like me) coming to this page now. Alex de Silva's answer works great but needs some update:
Instead of the command play or activator use sbt The sbt dist or sbt stage command are described here. If you use play it won't work at all & in the case of activator--which is outdated--it will fail with some "can't find dependency" errors. Make sure you have latest version of sbt installed.
The same instructions apply in any sbt-based Scala application, not just Play Framework. You just have to be sure you have the sbt-native-packager plugin set up properly in your sbt build.
I have modified the Web content folder & then did the Clean project followed by build project. But still there is no change in project.
I am using tomcat server 7 & JRE1.7.
What is the best way to build a java dynamic web project? How to ensure each & every file of the project gets re-build?
I cannot create a comment on this question so have to put it up as an answer..
Java dynamic web project is not building
What kind of build tool are you using? i.e Maven, Gradle, Ant
I have modified the Web content folder & then did the Clean project
followed by build project. But still there is no change in project. I
am using tomcat server 7 & JRE1.7.
Tomcat is there to deploy your web project, so if your build is failing you will not be able to deploy it successfully to your tomcat server. Maybe you could provide us with some sort of error message?
What is the best way to build a java dynamic web project? How to
ensure each & every file of the project gets re-build?
Don't think you will find any "best way", but there's several options out there you can use. Fast google search for build tool
Maven
Gradle
Ant
This is just a few.
I have done a small project using Play Framework 1.2.4 and now I need to share it with my team members for further proceedings on that. I am using Eclipse Indigo for the project.
I tried exporting it into a WAR but when my team mates import it using the WAR option, they are getting lots of compilation errors.
Kindly let me know in which format should I share so that they don't get any compilation errors while importing it into their workspace.
From the documentation:
Play provides a command to simplify Eclipse configuration. To transform a Play application into a working Eclipse project, use the eclipsify command:
# play eclipsify myApp
You then need to import the application into your Workspace with the File/Import/General/Existing project… menu.
Your coworkers should simply get the sources of the project, and run this command to generate an Eclipse project. You don't have to export anything. BTW, a war file is a deployable Java EE artefact. It's not meant to contain the sources of a Play framework project.
Side note: it's the second answer that I give you in a row that can be found in the documentation. Maybe you should read it.
For newer versions of play the command is play eclipse
Then File -> Import.. -> Existing Projects into workspace
Don't check any boxes (ignore 'copy projects into workspace')
Excellent, I agree with #JB Nizet and Connor.However this answer applies to old version of PLAY framework. My answer might be helpful for developers using Play Framework 2.3+ and come searching, the command to transform a Play application into a working Eclipse project.
CD into your project source folder
Run Activator eclipse projectName
You are done ! Import the PLAY project as every other existing JAVA Project.
I have built a Java application that has some dependencies (~10). I would like to easily package this application up and deploy it as a single file to a CD or USB drive.
There doesn't seem to be any "nice" wizard to search the project, grab the dependencies and setup the classpath on the target computer. I have to do this manually.
Is there a better way? Something simple, easy and straight-forward. A link to a tutorial on this would be great.
Seems to me that this should be a built-in feature to eclipse. Deployment of a web application seems easy enough, but not a Java application.
Have a look at the Fat Jar Plug-In.
That's because desktop deployment isn't well defined.
You are heading into release issues which is a huge can of worms.
I assume you have some form of version control like SVN or git? If so check out maven with the release plugin and maven-assembly-plugin
It'll take a lot of work to setup, but once you get it going you'll be cross linking and deploying distribution packages in no time!
Plus you'll have access to the vast maven repos on the web right now
I have setup Spring / WTP in eclipse as well as successfully started a Tomcat 6 server within eclipse. I'm at the point where I can create a new Spring project and add source files as necessary.
Could somebody please describe (or point me to) how I can setup of some sort of 'Hello World' test and how to run it? I have experience developing in Java SE but am trying to learn Java EE / Spring.
Start with "Spring MVC Step by Step".
I know this does not answer your question directly, but you may want to consider generating a base project using Maven and then generating an Eclipse project from that.
If you decide to go down the Maven path, the process would be:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=2.1.0-M1 -DgroupId=com.mycompany -DartifactId=myproject
Details: AppFuse
Once you run the above command, it will set up a complete maven project for you with a Spring MVC project stubbed out.
The next step is to simply run: mvn eclipse:eclipse to generate the project.
Details: Maven Eclipse Plugin
Once you get the code generated and the Eclipse project set up, you can read on the AppFuse Quickstart page how to run the application locally, how to debug it, and go from there.
If you're looking at using Spring in a Web-app, then perhaps this previous answer I wrote might help?
For building Spring apps, SpringSource provides a build of Eclipse 3.5 called SpringSource Tool Suite. It includes a bunch of plugins that you can download independently, but this comes with them pre-integrated. It also includes a lot of guides, documentation, wizards, and so on, which might be good to get you started.
You may find interesting the Spring Roo project which creates a Spring MVC based project directly on the IDE or via the command line.
You might want to see the ten minute video to see how it can get you up and running in no time and it also includes other features which can be not that easy to set up like security and internationalization.