How to run a Play 2.2.1 project from Scala IDE? - eclipse

I have followed the Play tutorial to create a simple application, made sure it started using the "play" command and then running play eclipse I generated the eclipse project files. I finally imported the project into the latest version of Scala IDE bundle for OSX.
I would like to know if there is a way to run my application from within eclipse without having to use the shell to start play each time.
There is a similar question here, and the accepted answer says that a run configuration will be created in eclipse. In my case I can't see any, so that may have changed from version to version.

The short answer is no. You need to start the play server from command line if you want to load your application on a browser.
The long answer is that we (I'm a contributor to the Scala IDE project) are starting to work on sbt integration, which is the required building block for not having to run the play console on a terminal (because we can to do it for you in the background, once we have sbt support). My suggestion is to star the project I linked, and follow developments.

Related

Ninja Framework : Debugging via Eclipse and m2eclipse plugin - jetty:run does not start the server, builds instead

We are instructed to do the following (while using Eclipse)
And if you make a left click on your project you get the option “Debug
as…”. Hit that and generate a profile that debugs the goal jetty:run.
https://www.ninjaframework.org/documentation/debugging.html
However, when we do the jetty:run, we simply build the project, and the project does not start.
Furthermore, when we run with ninja:run, the debug does not stop at breakpoints.
What I need is a debug-mode that stops at breakpoints.
How do we fix this ?
The answer is in the Ninja Framework source code, and the new versions of a Jetty... and therefore, there is (probably) no answer without recompiling the whole framework to fix the issue. I have tried diff-ing the projects, but could not see anything that would fix the higher versions. Up until the version 6.4.0 (inclusive) running the command mvn jetty:run starts the server. Any other version that is higher than 6.4.0 just builds the project and then stops.
So, one of the solutions is to simply start a new project using the old-version code executing:
mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtifactId=ninja-servlet-archetype-simple -DarchetypeVersion=6.4.0
Another solution is to deploy (Jetty or Tomcat server) and try to debug the deployed jar/war file.
The first solution is simpler, however, the second one is more proper.
At the time of writing, the latest version is
<ninja.version>6.6.1</ninja.version>
<jetty.version>9.4.18.v20190429</jetty.version>

Play framework support in IntelliJ IDEA Community Edition

I installed IDEA version 15 with the Scala plugin, but Play projects are enabled only in the Ultimate edition. I'm new to Scala and Play, any issues if I run Play outside of IDEA? Would Play "hot deploy" any changes I make in scala source code?
Just open it as an SBT project and it's fine.
This is how it works: (1) create a project using play/activator, (2) open IntelliJ and import as SBT project (accept all defaults), (3) run the project in a command line (externally to IntelliJ), (4) edit project source files in IntelliJ - when you update a file, it is automatically compiled (you can see that refreshing the url localhost:9000)
Play works great outside of IntelliJ. I have developed play applications using Sublime Text and Atom. You'll get the errors in the console, or in the web application itself.
There's also a NetBeans plugin now (http://nbpleasureplugin.com), and the official ScalaIDE should also support it (although I've never tried using it).

How do I debug Lift applications in Eclipse?

I come from a background in C++, Python, and Django and I'm trying to expand my horizons and learn Scala and Lift. However, I'm having a really hard time figuring out how to debug Lift applications using eclipse.
I can create projects using some of the lift sbt templates and run them no problem. However, I haven't been able to start the application from within Eclipse because it can't find Jetty, and as a result, I'm not able to use the debugger to step through the Lift code. Weeks of googling haven't helped much.
Could someone share their methods or suggestions? I'm also new to the jvm, so feel free to share best practices or point out important differences that I may be missing.
Ok, I've gotten this figured out.
So I'm not actually launching the application from the Eclipse debugger. I'm starting the application through sbt, and then connecting the Eclipse remote debugger to the sbt vm that's running the webapp.
Here's what I did:
Assuming you have sbt-launch.jar in /bin:
Create the file /bin/sbt_debug with permission to execute and containing this line:
java -Xmx512M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar /bin/sbt-launch.jar "$#"
What this script is doing is starting sbt and instructing the jvm to allow debugging on port 5005
Go to your lift project directory in your terminal and enter sbt_debug. Once you're in the sbt console enter container:start / container:update or ~jetty:start / ~jetty:update depending on which version of sbt you're using.
Next go to Eclipse, click the debug icon and select "Debug Configurations..."
On the left column, click "Remote Java Application" and create a new debug configuration. Set the Port to 5005.
Hit the Debug button and the Eclipse debugger should now be debugging the sbt process you started earlier
Note: This is the first method that has worked for me. If you have one that is better, please share
I've found the most useful tools to be the SBT Eclipse Plugin and the RunJettyRun plugin for Eclipse. The former will allow you to generate Eclipse config files based on your SBT setup and the latter will launch Jetty from Eclipse with the debugger attached. An added bonus is that generating your Eclipse config using "eclipse with-source=true" from the SBT prompt will download and attach src jars as well so you can step through Lift and any other 3rd party libraries you depend on as well as your own code.

CloudBees + PlayFramework + Eclipse

I want to develop and manage my DEV#CloudBees and RUN#CloudBees workspace from Eclipse, for a PlayFramework project, and I will have to work with it from several different PC. I'm using the Cloudbees SVN repository, Jenkins CI solution, database ... everything.
I installed CloudBees and PlayFramework plugins for Eclipse, created my CloudBees account, SVN repository, project, Jenkins Job and database. I've created my Play project, eclipsified it.
I understand and I have tested each component of my targeted working environment but I didn't manage to make them work smoothly together.
1- I've seen some Play modules for CloudBees but it is only for command-line use. Is there a nice Eclipse plugin wrapper for this ?
2- I have some issues writing the build.xml, especially when referencing the PlayFramework libs, because I can not use the local installation as it won't work on Jenkins.
3- How can I deploy to RUN#CloudBees from Eclipse ? If i use the CloudBees plugin, it doesn't package the PlayFramework libs.
4- How can I use the testing features of Play to be integrated in Jenkins ?
I have a lot of questions but it is enough for now :) By the way, PlayFramework is awesome and CloudBees a life-saving work environment.
Thank you for your help.
Contact the support, they are really helpful..and fast!
they do have a plugin for Jenkins, ask to get it installed on your server..I use the command
play auto-test
and it works fine. You'll need some code to check for failures depending on the .failures files. check this link
I received a very quick and efficient answer from Cloudbees support.
It confirms what mericano1 and Ryan said (thanks to them).
The CloudBees Jenkins service let users install some customization plugins like the Play! Framework one !
After adding it to the core configuration, you can add a new build step "Play!" in your job configuration and set the Play! commands you need. For example "clean", then "deps --sync" and finally "auto-test". You can also add the war -o toto.war if you need the binary.
You can check the "Play! auto-test reports" checkbox. You'll have an additional icon "Play! Test Result" in the left menu of the build result page to watch the ... Play test result page (unbelieavable :)).
Still in the job configuration, you can check the "Deploy to CloudBees" features. I didn't tried but I think the Play! libs issues wouldn't be resolved. So, add the cloudbees 0.2.2 plugin in your Play! project dependencies.yml, and you can add the bees:app:deploy command in your build step.
For Eclipse, the CloudBees plugin is fully functionnal, once you have configurated your Jenkins job. But you should stay with the Play! process to develop locally and not the Run DEV#/CloudBees Local.
1) The cloudbees module is only for the command-line. There is no Eclipse plugin (that I know of). However, the command-line is really simple play bees:app:deploy
2) Not sure here
3) Deploying Play Framework Apps is a bit different from deploying J2EE (because of the necessary play war command), thus deploying a Play app to Cloudbees from Eclipse might not be possible. However, see 1).
4) I think there is a Play plugin for Jenkins. I have never used it on/off Cloudbees.
OK, so I provided some help on questions 2 and 4, and unfortunately, the answers may not have been what you hoped. I suggest switching to command-line when it is time to deploy.
In eclipse click on external tools menu and create a new command as noted by Ryan in 1).
then you can simply click on the external tool icon.

Hadoop 0.20.2 Eclipse plugin not fully functioning - can't 'Run on Hadoop'

I've just finished installing Hadoop 0.20.2 under Cygwin on Windows 7 with Eclipse Helios (3.6). Hadoop is now fully started, and I'm trying to run a test application within a newly created MapReduce test project in Eclipse. I'm using the Hadoop 0.20.2 plugin from the Hadoop download.
The Map/Reduce Location perspective operates correctly, as does DFS Locations tree in the Package Explorer. However, when I right-click the driver, select 'Run As' > 'Run on Hadoop', nothing happens and no errors spawn on the Console (silent fail :(). I believe a dialog window should appear asking for config before it runs, but this is not happening.
There seems to be a few others with the same problem, but I've yet to find an answer that works. I've tried the 0.20.1 plugin (total fail). The following bug report seems to describe my issue, though I'm a bit of a newbie to all this, so could do with a hand / voice of experience to help out: https://issues.apache.org/jira/browse/MAPREDUCE-1280
The hadoop eclipse plugin bundled with the hadoop distribution is compatible with eclipse up to version 3.3. The JIRA-ticket MAPREDUCE-1280 contains a patch for running the plugin in eclipse 3.4 and upwards.
I just compiled the patched plugin with the fixes from the JIRA-ticket MAPREDUCE-1280. The file is attached to the ticket. You can find it here.
Simply remove the old plugin from your eclipse-installation and put the new version of the plugin into the dropins-folder of your eclipse-installation.
After upgrading from an older version of the plugin you will have to start eclipse with the "-clean" command line switch. Help on eclipse command line switches can be found here.
I don't know whether the plugin has been updated or not, but as far as I know, that one is out of maintenance for several previous releases.
One of the solution is that you should download the source code and try to re-compile the jar file for that plugin (for the latest version of eclipse), however I didn't try it so don't know whether it is working.
Maybe you can try to use Karmasphere.
askswOrder is correct that the Eclipse plugin has not seen much attention for quite a long time. The JIRA you reference does provide a fix, but it's only been applied to Hadoop 20.3 and above. One option would be to try to apply the patch to 20.2 and recompile, but that's asking quite a lot from a newbie. I'd second the suggestion to use Karmasphere; it's a great product for working with MapReduce and those gents have taken on the work of staying current with Hadoop releases.