GWT+Eclipse without GWT_CONTAINER - gwt

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

Related

Eclipse Plugin - one of the plugin projects in "features" won't compile

My plugin is built by two plugin projects (two plugin projects are in the same workspace).
One of them is an ordinary plugin which has toolbars etc. The other one is a Scala-based XML interpreter.
Everything runs fine and works great while I use "Run/Debug" as "Eclipse Application".
But, after I tried to pack it as a Feature project then Build it with and Update Site Project, the auto-generated JARs are wierd: the content of the ordinary plugin JAR is classes, which is correct; however, the other one (in scala), Eclipse packed the JAR with the original file - filename.scala in the JAR!
In other words, the plugin project didn't get compiled after Build(in Update site project by putting Features in).
But it worked fine when I used "Run" as "Eclipse Application".
Does anyone know how to fix this? Or any hint?
I've tried this but it didn't fix my problem.

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

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!

How can I set the java.library.path used by eclipse from a POM?

I'm using maven to define my projects. One of my dependencies requires a native DLL at runtime, and consequently it's needed in tests and for debugging. The native DLL is available at a known location. I want a solution that I can check in once and will work for all developers without manual setup by each dev.
I know I can set the java.libary.path manually in "run configurations", which will allow it to find the native DLL, but this requires manual setup for each developer.
I know I can also set the java.library.path for a given project dependency, but again this is local to a particular developer.
Finally I know I can set the surefire plugin to specify the java.library.path, but this is only useful for tests triggered via maven - so it's great for our build server, but doesn't help devs using the JUnit runner in eclipse, or wanting to debug or run code directly from eclipse.
Is there a way out?
I've found that the eclipse m2e connector that goes with the maven-nativedependencies-plugin seems to fix this.
According to the mavennatives docs:
Since version 0.0.7 of the maven-nativedependencies-plugin if you have
m2eclipse installed and the nativedependencies plugin configured the
unpacking of natives will run automatically, you don't need the
eclipse plugin to unpack them. However in order to setup the
java.library.path environment variable in eclipse you will have to do
it either manually or automatically using the eclipse plugin.
This Eclipse plugin is an extension to m2eclipse, it detects if you
have the maven plugin configured, and if you do it executes the
unpacking of natives, and configures the Native Library Location.
If you import a maven project that has the mavennatives plugin
configured, and you have the m2eclipse integration plugin, on import
the natives will be extracted, also when performing a clean from
eclipse the natives will be extracted.
So, if you use both these tools, using native dependencies requires no
manual configuration, other than whats in the pom, just run your app
and it works.
If I have the connector installed, and add mavennatives to my POM, then reload the pom (right-click on project in package explorer > maven > update project), the "Native library location" of the project is populated automatically (to see this, right click on project > properties > java build path > libraries > native library location)
This seems to work for debugging, JUnit runner, etc.
It does require that every developer install the plugin, which is manual (as manual as installing eclipse); however, at least once installed once it will work for any/all native depdendencies configured for mavennatives via a POM.
The Properties Maven Plugin may help you passing the system properties by using properties:set-system-properties to set system properties.
The example should be look like the following: -
<properties>
<java.library.path>some/path</java.library.path>
</properties>
I hope this may help.

m2eclipse and Eclipse WTP

I have a very large workspace with about 30 projects all together. I am using Eclipse 3.5 with m2eclipse. I check out of my subversion repository using the defaults in order to import the projects into my workspace.
I create a Tomcat server instance, and publish my web project to the tomcat server. Sounds easy enough.
The problem is that it does not appear as though the transitive dependencies for my other projects are being automatically added to the container, so when the container starts up I get classnotfound exceptions, etc.
I go into the web project's properties, and I notice that the Java EE Module Dependencies are NOT checked for some of the transitive dependencies. I check them, and everything seemingly works until I do a project clean build, when the Java EE Module Dependencies are automatically reset by eclipse, so I need to recheck them. This is maddening, and I was hoping there was some way to automatically pull in all of the transitive dependencies when working with Eclipse WTP.
I should mention, using standard maven build works just fine, and everything gets pulled in appropriately into the resulting WAR file. It just doesn't work so good with WTP for some reason.
You need to make sure that you have "Maven integration for WTP" feature from m2eclipse installed. There is a simple tutorial available at http://docs.sonatype.org/display/M2ECLIPSE/WTP+mini+howto
What version of WTP and m2eclipse you are using? Check that dependency version declared in project's pom.xml matches with version declared in workspace project and make sure that workspace dependency resolution is enabled.
Also, you can try to run "Maven / Update project configuration" from the project popup menu and check that there is no errors on Maven console and in Eclipse's own log.
If the above won't help, try to reproduce issue on a smaller project and then submit it with a bug report
It appears as though the latest version of m2eclipse (.99x) solves all of my issues.
If you are tempted to use m2eclipse wtp extras you need to be aware that they are not supported by Sonatype and, although mostly OK, are not 100% robust.
See http://maven.40175.n5.nabble.com/What-is-the-recommended-alternative-to-m2eclipse-extras-WTP-integration-td135727.html

synchronising / maintaining ant and eclipse classpaths

I'd be interested to find out about any automated processes that people have for ensuring that the project classpaths for the ant and eclipse configurations are in synch. In my case, I want the classpath defined in the ant build file to be the master configuration, since its used for our production builds. As part of the build i'd like to add an ant target that will verify that the eclipse classpath is up to date, or at least indicate differences between the two classpaths.
I'm aware of ant4eclipse but its focus is in the opposite direction, ensuring that the eclipse classpath is master and that the ant build reuses the eclipse path. I like the idea behind AntAndEclipse but am wondering are their ant other tools in this space that i'm not aware of.
You solution at a previous company was to have ant invoke Eclipse to do the compiles as described here:
http://www.eclipse.org/articles/Article-PDE-Automation/automation.html
I'm not aware of any ant tools which can do this but I've switched from ant to Maven a few years ago and never looked back. You can use the "Maven integration for Eclipse" to make Eclipse use the Maven classpath.
As of today, I'm not 100% happy with the Eclipse plugin, though. It's a bit slow and due to the different philosophy of Eclipse and Maven, some operations behave strange. For example, Eclipse doesn't differentiate between a "production" and "test" classpath, so you can get compile errors in Maven when everything looks great in Eclipse.
My solution was to use the plugin to keep the classpath in sync and compile from the commandline.
there is an ant task to do xml transformations, we used that task to create the classpath in our build file. It was a little trick to get the XSL right but once it worked it was great
Did you evaluate Apache IVY? Currently I am building a Continuous Integration environment at our place and we use IVY to handle our dependencies. There is a eclipse plugin that takes the dependency configuration of eclipse and uses it as eclipse classpath.
Currently this solution looks quite promising.
My team wrote an Eclipse plug-in to add a new type of library to the Java Build Path->Add Library option in the project settings. This custom library type allowed both Eclipse and ANT to reference the same canonical list of dependencies.
Nowadays, I'd probably look at IVY for doing the same thing if I was locked into using ANT, rather than writing my own.
You need Ant2Eclipse.