How to install play2War plugin (Play Framework 2.1.1.) - java

I'd be very grateful if someone could provide me the basic steps to install the Play2War Plugin. Like where to put the plugin files?, and which files?
I'm pretty new with Play Framework (Java, I'm not a Scala developer, ...yet), just created my first application, and want to deploy it on my server, with is a CentOS with Tomcat/ Glassfish installed, but unfortunately I found out that the 2.x version didn't have the built in war command anymore. I scoured the documentation and found the links Configuration, Usage and Deployment, but what I want to know are the steps until get there.
I started looking for sbt building tool ('cause Play2War Plugin uses it), until I realize that Play Framework 2.1.1. already have it installed (at least that is what I believe. See: *PLAY_HOME/framework/sbt/sbt-launch.jar* and *PLAY_HOME/framework/build*). Am I correct?
Thanks in advance,

As Play 2.1.1 already has SBT its as simple as doing the following:
Within plugins.sbt add:
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.0")
Then within the Build.scala file add:
import com.github.play2war.plugin._
...
val main = play.Project(appName, appVersion, appDependencies)
.settings(Play2WarPlugin.play2WarSettings: _*)
.settings(Play2WarKeys.servletVersion := "X.X")
The X.X needs to be changed to the required Java Servlet version (usually 3.0 or 2.5 depending on your container)

If you have a working play application, you are already using SBT tools to build. Yes, SBT comes with play.
The play2war plugin tutorial provides a step-by-step instruction. Simply follow the tutorial, you should be fine.
To answer your question, where to put the plugin file?
As the tutorial suggests, you need to modify files like APP_HOME/project/plugins.sbt, APP_HOME/project/Build.scala. You should already have these files, you simply need to add those lines to these existing files.
If you have a specific problem, please provide the error message.

Related

Communication between Play! project and Java project

Good morning to all.
I have two projects, one as Java Project, and other made with Play!.
Both projects are in Eclipse IDE.
I need to consume a method in Play! project from Java Project.
How can I do that?
Thanks for helping.
I've never used the Play Framework myself, but what you usually do is put the JAR-file you like to use the method from in the "lib" folder in your play project and tell your IDE to add the lib to your java classpath. I'm guessing you're using an IDE to develop your app (would be great if you could mention it in this case).
That should be enough to access the method from the java project and compile your code. I'm not sure if you need to configure the play project to access the lib at runtime.
For more specific help you need to provide more info what you actually want to do and what tools you're using.

How to generate JSR-172 stubs

Back in the old times, the Sun Java dev. toolkit (v2.x) used to have a stub generator tool, but no longer in 3.x versions. I can still use the old generator, but it is very picky when it comes to input WSDL files, and the errors generated do not contain any useful info to fix the WSDLs. The company that develops the SOAP WS is providing me with WSDLs not compatible with JSR-172, and I need to prove I'm using the the last official tool available to show there's no problem on our side.
I have installed the last reliable version of JavaME SDK (3.4) available at Oracle's site. These 3.x versions do not include an IDE, instead they provide plugins for Netbeans and Eclipse. I'm an Eclipse person, but I've opted for the Netbeans approach because looks easier to configure.
So I've downloaded the last Netbeans version (7.4). I've downloaded the bare-minimum JavaSE only version, then installed the mobility plugin for JavaME (Last time I needed to install Netbeans, you had to install the full JavaEE IDE plus GlashFish servers, etc. So glad to know they now offer the option not to install the full IDE).
Added the JavaME SDK v3.4 in platforms, but it does not detect it automatically. I was forced to configure a custom platform, but then the ant build failed. To solve this, I've installed the JavaME SDK v3.2 as well, which is detected by Netbeans out-of-the-box and builds fine.
You might think the stub generator tool would be available by now. Wrong!. You still have to go and install the "SOAP Web Services" netbeans plugin, which in turn installs a ton of other dependent plugins (by now the lightweight JavaSE install has become the bloated JavaEE-ready IDE that Netbeans has always been).
So then I created a basic JavaME project. Right-clicked over Source packages, then selected "New" -> "Java ME Web Services Client". The stub generator dialog is finally shown (and it looks pretty much like the old Sun Java CLDC 2.5.2 tool). I select the WSDL input file, type the client name and package name, and also ticked the "Generate databindings structures" checkbox (which I don't know what the heck it is for, but suffice to say I've tried both w/ and w/o this option selected and the result is the same).
Then I click the Finish button and only a .wsclient file (along with the imported wsdl file) is created. What is the purpose of this file? But most importantly, where are the .java or .class files? They are nowhere in the project folder!
Questions:
Is it possible to generate JSR-172 stubs using Netbeans?
If not, is it possible to do this using the Eclipse JavaME plugin?
It turns out there is a problem with the input WSDLs. They are valid but something is wrong because Netbeans does not generate any java file.
I've tested again with a known good WSDL and it works, so the procedure I followed is correct.
UPDATE:
I was using a local WSDL input file, and due to a bug in the SDK, if the file path contains whitespaces, the stub generation fails. In NetBeans no error is shown.

How can I add Java Template Project in Xcode 4?

I wanna know how can I add Java Template Project in Xcode 4.
I'm working with Eclipse and it's really fine but i want to write Java program in Xcode.
Thanks for helping. ;)
Java is not a first class citizen of Xcode anymore, so you should in my opinion stay with Eclipse.
I realise this question is 6 years old, but I have a similar problem and found what seems an easy solution. I have an old Java project (2008-9) which I maintain but has been dormant. As I prefer to keep it into Xcode I transferred the whole project (sources, project files and all paraphernalia) to a new development machine running el Capitan with Xcode 7.3.1. I opened the project (which was still in 3.1 version) with it, and tried to build it. It failed as Ant was missing. So I downloaded Ant (version 1.10.1) and copied its bin and lib directories under /usr/local/ant, then I changed the project external build tool configuration (under project, go to Info, and you'll see that parameter) which was set to /usr/bin/ant and set it to /usr/local/ant/bin/ant or wherever you put it. Build again and this time it worked.

Which Eclipse IDE version to choose?

How do I find which Eclipse version I have on my Ubuntu system?
This is what "About Eclipse SDK" says.
Eclipse SDK
Version: 3.5.2
Build id: M20100211-1343
I am not sure if its the Eclipse IDE for Java Developers or the Eclipse Classic version.
What I would like to do is use Eclipse for
Java based Web Application Development
Ant Builds
Deploy using Tomcat
including HTML, CSS Editing
Please help me decide which version I should choose? I would like to upgrade my Eclipse setup from whatever version it is now to a version that supports all the above. Should I go for Eclipse IDE for Java EE Developers?
Should I download a totally new version from Eclipse site or can I just ADD necessary features/plugins to my current Eclipse setup.
Please suggest.
See Compare Eclipse Packages for a nice chart
What I would like to do is use Eclipse for (...)
The Eclipse IDE for Java EE Developers allows to do what you're asking for out of the box.
Should I download a totally new version from Eclipse site or can I just ADD necessary features/plugins to my current Eclipse setup.
Both would work, although it would be simpler to just get directly the Eclipse IDE for Java EE Developers (especially if you don't know exactly what plugin(s) you're looking for). Personally, I don't use the version you can get from the repository but download Eclipse from the official website and install it in user mode.
If you are using Eclipse for only Enterprise Development, then as everybody has recommended I would use the Eclipse Java EE version. If you plan on occasionally using it for other development purposes then I would consider downloading a separate classic version as well.
The reason for this is that everybody is well aware of eclipse's plugin capabilities. Unfortunately, Eclipse can get bogged down with too many plugins or add on tools. What I have experienced is that if you are using it for Enterprise Development(J2EE) it might be a good idea to keep that as a separate environment then your other Java Development. That way you can download the plugins,tools,libraries,etc for your enterprise development, and you can use your classic version for any other development you might need.
The downside is you will have two versions, but this is not a problem granted you do not run them simultaneously.
If you want to play with Web development, then the Eclipse java EE for Developers is for you. It is shipped with components to make Java Enterprise applications to create Enterprise Applications (and bundle it in an Enterprise ARchiver, known as EAR file or Web ARchive, known as WAR file).
The default Eclipse shipping with Ubuntu is the Classic version, and you can add more plugins.
I would recommend, however, to download th eJEE version manually and unzip it and run. Then you have a local installation outside the system files.

Importing Liferay portlet into Eclipse IDE

I have a question regarding the development of liferay portlets using the liferay plugin SDK. My question goes mainly in the setup of the development IDE. The suggested one would be to use Netbeans IDE which I also tried out, but it appears to run very slowly on my machine while Eclipse is quite performant.
The setup for Netbeans IDE is the following
Go to the directory \portlets
Run the create.bat (or sh file depending on the OS) to create a new sample portlet
Run Netbeans IDE, create a new "Java free form project" and point it to the directory of the created sample portlet
That's it, pretty simple.
For the mentioned reasons above (and because I'm a lot more familiar with Eclipse) I'd like to import the project into Eclipse the same way. Is there a way for doing it without having to change too much in the original structure of the created sample portlet and the according build.xml (ant file)?? I tried already to create a new project out of the build.xml ant file of the created sample portlet, however in this way it doesn't include me the source code.
I didn't also find great tutorials on the web...
Could someone help me with this, pointing out online tutorials or give me some hints.
Thanks
I know your pain. Starting to work with Liferay needs much time. I you do not want to edit the existing source, but only crate your own portlets, you can download the plugins SDK from the 'Additional Files' section on the Liferay website. This provides ant scripts, to create a simple JSR compliant portlet, and to create all necessary things, to create a sound Eclipse project, for example:
ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create
Than cd into the directory of your created portlet an do:
ant setup-eclipse
After that you should be able to create a new project from the sources in that directory in Eclipse, which can then be deployed via another ant script to the running tomcat instance. If you already know somthing about portlet programming, you shoud be pretty much settled now. If not, try to find documentation about JSR portlet programming first, before looking into Liferay specifig portlet development.
Liferay has now released an official set of Eclipse plugins that support portlet development. Here is the installation guide for installing the eclipse plugins:
Liferay IDE Installation Guide
Also there is a getting started guide that shows what to do after installation to actually setting up your first portlet project.
Getting Started Tutorial
Liferay IDE uses the Plugins SDK from Liferay under the covers to do all the work. If you already have existing projects that you created with the Plugins SDK those can be imported into Liferay IDE as well.
Importing existing Projects
you can find the tutorial for deploying liferay in eclipse
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)
No clue about Liferay's specifics, but in general, I'd do this:
Follow the steps 1 and 2 from your NB setup list
Create a new Dynamic web project (or a Java project if you don't need the web project's features) in Eclipse
Import the contents of sample portlet directory by doing Import -> File system in Eclipse
Adjust the project's Java source directory to point to the generated sample portlet source directory (that should now appear in your project)
Adjust classpath of the project, point it to LR lib folders, ...
If there's a generated build.xml, check if it can be used to deploy to LR, or to produce builds.
As of March 2011, there is some official Liferay support for NetBeans and as noted before, there is official support for Eclipse ( In the Marketplace). The Documentarian uses Eclipse himself, though many examples just use the Plugins-SDK with shell scripts, ant scripts and no IDE.
We are fighting with Liferay on Eclipse, Eclipse seems buggy and unpredictable, but we are also new to J2EE and Eclipse ( so discount this last comment a bit), and I have our portlet files setup in a separate area for SVN, requiring a refactor-move, refactor is definitely buggy.
You should be aware that there is a book for developers on the way from the official documentarian - we've bought the early release and found it useful. He does cover some IDE issues. See Manning press.
The Liferay sample portlets ( there are many) are not set up for Eclipse projects, and you'll have to import some java files and jump through some Eclipse hoops to get them into a running Eclipse project you can develop.

Categories

Resources