Can i use the google app engine eclipse plugin with a maven gae project? - eclipse

I migrated a GAE project to a Maven project with the official way (https://developers.google.com/appengine/docs/java/tools/maven) but I don't want to use Maven to deploy/use devserver.
When I'm using the GAE Eclipse plugin I get an error:
Could not locate /path/to/project/target/WEB-INF/appengine-web.xml
Is it possible to use the GAE eclipse plugin or must I use Maven for deploying/local server?

I found the current process to do this a bit tricky, but it is possible. And it works pretty well after fiddling with it... I've been happy to have Maven manage the dependencies and I've found myself using it to test/deploy too. The key to getting it to work can be found in the GWT docs: In particular, you need to use a "dynamic web project" in Eclipse, rather than the normal (to me) GAE project.
Create the Eclipse Dynamic Web Project as in the link above, including changing the source folders to the proper maven-like location, and changing the web module location to the maven location.
Copy your source files in the right places.
Add the pom.xml file to the directory. At this point, you should be able to go to the command-line and run mvn appengine:devserver
Back in Eclipse, go to the project properties and turn on Google -> App Engine: Use GAE, and use HRD.
To be able to use m2eclipse to manage Maven dependencies and take Maven actions in Eclipse, you need to convert the project to a Maven project, as per this StackOverflow question
You might need to shutdown Eclipse, rebuild via Maven, restart/refresh Eclipse. At this point, you should be able to build/debug/deploy via Eclipse or via Maven!

Related

Source jar files in eclipse

I am using eclipse and having difficulties in finding the related source jar files (including recursive dependencies) manually and linking each one of them to the 3rd party jars in the project class path. I need the source to understand the 3rd party functionality better.
What is the simple way to address this issue?
Your problem is twofold:
First, you have to get (read: download) all the source jar files you need.
Second, you have to tell Eclipse how to find the source jar for a given library.
If you create an Eclipse application (a product or plug-in based on Eclipse Platform or Eclipse RCP) which uses OSGi-Bundles coming from a p2 repository, and if the p2 repository contains the sources, you can usually install the "SDK" feature of the respective project to get the sources.
However, from your question I guess that you are developing a Java application (without OSGi or Eclipse runtime). In this case, I know of no builtin feature of Eclipse which could download and attach the source code for your library jars.
As Phantom Reference said, the best way is to use a tool which is able to download all the referenced jars including their source automatically. And, yes, Maven seems to be the tool of choice, because of its automated dependency management and resolution features.
BTW, if you don't want to use Maven (e.g., because you don't know it and you don't have time to get into it), you could still manually use a Maven repository to find the source (and binary) jars of most common 3rd party libraries there.
Have a look at http://search.maven.org.
I suggest you to move to maven build tool if you are not using it already.
You can configure the maven plug-in in eclipse to do this job for you.
Here are the commands to get the source code as well as the Javadocs by maven itself from command line.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
Here is the screen shot from my eclipse Windows --> Preferences that shows how to configure Maven to download and attach the source as well as Javadocs, all automatically. Hope this helps.

How do I mavenize a JSF 2.0 project in eclipse?

I have a JSF 2.0 project on my eclipse. I would like to mavenize the same preferably from Eclipse itself. I tried doing it from outside the eclipse manually. There are quite a few steps and I don't like the manual nature of that approach. Could someone help?
Make sure that you have the standard folder structure as recommended by Maven for web projects. Follow this link.
Now, install maven plugin in eclipse (am not sure if it is available by default or we have to download it manually). Simply right click on the project, select Configure and Convert to Maven Project. This should automatically do all that steps to takes to mavenize your current project. This will create a pom.xml file and you can modify it going forward as per your requirements. By the way, I use Eclipse Juno.

GWT+Eclipse without GWT_CONTAINER

The situation
I'm using GWT with Eclipse and Google Plugin for Eclipse (GPE).
Gradle is the build tool and the Eclipse classpath is generated by Gradle. As I have no "com.google.gwt.eclipse.core.GWT_CONTAINER" on my classpath, GPE always shows the error "The project 'Test' does not have any GWT SDKs on its build path" and the Console sometimes prints "GWT SDK not installed.".
Annother effect is that Eclipse doesn't let me GWT-compile the project (but running dev mode works fine). But that one is ok for me, as I compile using Gradle.
Things I'm aware of
I know that I can exclude all GWT depedencies from the Eclipse classpath and add the container through Gradle (I did that for other projects). But as I can't enforce the GWT version provided by Eclipse (I can only specify the SDK's name in the classpath by adding the suffix "/" to the conatiner), I think thats an ugly solution. Another point is that the GPE update site only lists the latest GWT version available. There's no way to automatically install an older version (yes you can provide one externally).
When using GPE together with Maven and m2e it simply works: GPE links no real SDK for Maven projects but there's a link to the "com.google.gwt" group in the local Maven repository. But that's magic I can't use because:
Gradle's local repository format is different to Maven's
This logic is implemented in the plugin "com.google.gdt.eclipse.maven" and I can't use that without adding a pom.xml to the project
The questions
Is there a possibility to deactivate this nasty error without loosing other GPE features?
Is it possible to do something similar to what GPE+m2e does without
creating my own Eclipse plugin?
Am I right that excluding the jars and adding the container is the only viable solution by now?
You can adapt this library to launch with custom classpath and other settings: https://github.com/eclecticlogic/gwt-launcher

How can I execute Maven goals from Eclipse without M2Eclipse?

I am using the eclipse plugin for maven to generate eclipse projects from maven pom.xml files.
mvn -Dwtpversion=1.5 eclipse:eclipse
This works fine and, after some experimenting with several of the 400 different archetypes available, I settled on using the webapp-javaee6 archetype, which was the only one which generated a set of dependencies that were both all available and which created a project that was useable by the WTP plugin.
The problem now is that I would like to be able to invoke mvn goals from eclipse. The accepted way to do this I understand is to use the m2eclipse plugin, which I have installed.
However, after playing around a bit and getting nowhere I discovered this comment in my .project file:
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
Further searching (see this lengthy diatribe from October) suggests I'm not (just) being stupid in not being able to get this to work.
The how-to linked in the top answer to this question seems hopelessly out of date.
So, the real question - what is currently the correct way to use maven to generate a WTP-friendly project that can be converted to eclipse and then use eclipse to call the project's goals?
Have you tried File -> Import -> Check out existing Maven Projects from SCM? My understanding is that m2eclipse will then create the eclipse project for you. If the packaging defined in the pom is war, the project should be deployable with WTP. (The latter used to require an the maven-wtp-integration plugin as well, don't know whether that's still the case).
Not sure about WTP or maven archetypes, but have you come across SpringSource Tool Suite (Spring packaged eclipse) and created a Spring Roo project? You can use this to create a data driven maven built web-app in a few mins. You can even remove the spring roo bits if you don't want them, it will give you a good starting point for a web-app with very little pain.

Eclipse Automatically Download / Update JAR files

I just created a Web App project from a repository through Eclipse's SVN support. What I would be doing is have an ANT build going and then finally deploy through Tomcat.
I am using Eclipse IDE for Java EE developers on an Ubuntu system.
There are a number of jar files needed
to support my project - like Struts,
Hibernate, etc. etc.
Do I need to
manually download each of them
and put them in the lib folder?
OR
Does Eclipse have a solution to
automatically UPDATE these from the internet? Any plugins to automatically take care of this?
You should consider using Maven for your project. It's VERY well supported in Eclipse, and handles all dependencies (as well as other things, such as releases).
The problem is there's a bit of a learning curve, but if you intend your project to get to a considerable size, I'd say it's very important.
Maven has support for ant builds and most libraries are in the central Maven repository. You just say your project has a dependency on the external project and it will automatically download the dependencies.
http://maven.apache.org/