Eclipse + GWT 2.8.1. : Changes to *.ui.xml files don't show up although super dev mode is active - gwt

When I change a ui.xml file (e.g. change css styles), these changes don't show up in the application.
The only way to get the changes visible is in Eclipse to choose
Project-> Clean ... and to remove and recompile the whole project.
My settings:
-noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -war "${workspace_loc:NewComApp/war}" -codeServerPort 9998 com.myapp.MyApp
My tomcat (alhtough I understand that this does not influence the superdevmode):
Anyone experiencing the same problem.
This makes iterations during development very slow, because compiling the whole project because of some minor changes to the layout seems ridiculous.
The ui.xml files are located in the same package as the java source files:
Any advice on this?

After a lot of research and a little help from a friend I want to describe the solution.
First of all you need to understand that SuperDevMode (like DevMode) translates what it finds on the classpath of the JVM where the SuperDevMode runs.
So for the solution in Eclipse it is necessary to point the classpath to the source directory.
For this you need to open the config dialog of your SuperDevMode:
Means make super sure that your source comes first!!
Means that you must make sure all your project and libs are available
For 2. You need to open "Java Build Path" select "Order and Export" your Project Properties in Eclipse.
After that you you just hit F5 in eclipse to see any changes (ui.xml or java code) instantly compiled by SuperDevMode compiler instead of Eclipse Project Build compiler
Along with a tomcat installation this lots of time.

Related

Eclipse does not show source code of maven dependencies in debug view

I've filed a bug by now: 495662 - Source Lookup: Not seeing source code in the debug view.
My issue sounds familiar but it can't be since that issue appears to be fixed. However,
I have set a breakpoint in a class coming from a dependency (via maven). The source code got downloaded but as the program reaches the line all I get to see is
Source not found.
I've tried to add lookup paths by clicking at "Edit Source Lookup Path..." but nothing changed. I don't know what I have to add such that the debugger finds the sources.
It appears that this stopped working for all my dependencies.
How did I break my source lookups and how can I fix it?
Could be important:
I am running my tomcat from a maven build these goals:
tomcat7:run-war -am -pl mz-web-server -Denv=dev
but this hasn't been a problem so far.
Further, none of my maven dependencies e.g. gwt-user*.jar or `spring*.jar or anything are listed in the Source Lookup Path. There is only the "Default" path which doesn't contain it either - shouldn't those jars be somewhat listed there?
After downloading Eclipse Mars 2, removing my project completely and re-importing it without any .settings, .project or .classpath files, I am still seeing this problem. I can't tell if this is really an Eclipse bug but at this point I don't know what else it could be.
I also tried removing C:\Users\<username>\.eclipse and restarted the IDE without different results.
These are the included libraries under Maven Dependencies. As you can see e.g. spring-security-core-*.jar is included and the source is pointing to the local maven repository. Clicking on edit I see the full path C:/Users/Stefan/.m2/repository/org/springframework/security/spring-security-core/4.0.3.RELEASE/spring-security-core-4.0.3.RELEASE-sources.jar and yes, the file is really there.
My Classpath Variables:
I don't know what the actual problem was and why it stopped working. As you can take out of my question I actually downloaded a clean version of Eclipse, checked out the naked project and imported it with maven without results.
However, I found this com.ifedorenko.m2e.sourcelookup plugin. The link was provided in "Java Debugging: Source not found".
Go to Help > Install New Software .. and use
http://ifedorenko.github.com/m2e-extras/
to search for the links. After installing this plugin I was finally able to debug the source code of dependencies.
Tested for Eclipse Neon:
Press 'Edit Source lookup ...', press Add button for 'Java Classpath Variable' in dialog and choose M2_REPO variable and press 'Extend...'.
Then choose source jar file for wanted dependency from file system tree.
After that press 'OK' on all dialogs and relaunch debug process.

Eclipse Mars - Web Application - Tomcat - Maven - Deploy and Debug

Is there a foolproof simple method to run and debug a Simple (tutorial level) Maven Web App in a local apache tomacat server from Eclipse Mars?.
I am developing a web app and I am able to run it sometimes, and sometimes not, and I am able to debug it sometimes, and sometimes not. Its a bit frustrating.
My current preference is to run the project from a Maven configuration having as goal tomcat:run. It builds and runs always, but it wont debug, i.e. if I place a breakpoint within my Java code in the servlet code, it is not reached. (some times it is reached the first time I run the project, but then it fails to find the source code of some file, and stops breaking for the subsequent runs...)
I have tried also "Debug on Server" configuration, but then, in that case I had to run a Maven install before running the project or, otherwise, some classes would not be found. And that also stopped working now. It just cant find some of the classes from src, although the Web Deployment Assembly configuration has the source being deployed into WEB-INF/classes.
(you may have been downvoted because there are a few questions lumped in to one. I'll try to answer them all because I'm all too familiar with your pain)
Eclipse's maven integration is notoriously flaky when it comes to debugging webapps, even with MARS. You can indeed use tomcat6:run or tomcat7:run for webapps. Here's a few 'best practices' that keep me sane:
Always execute 'clean' as part of the goal.
Make sure you follow the standard maven WAR project layout. You can break from this but have to be careful to specify all the overridden paths for META-INF etc.
When you stop/kill the process in Eclipse, you will often find that the process actually continues running but has detached itself from eclipse.exe as a parent process. You need to manually kill the java.exe process or you'll find 'port already in use' errors. ProcessExplorer is very useful for keeping an eye on this.
When you hit a breakpoint and it says 'source not found', there are a few things you can try.
Add your maven installation under window-preferences - maven/installations. Set this as the default one.
In your run configuration, make sure that you are using your system installation instead of the embedded one.
When you hit a breakpoint, close the editor and then reopen it by clicking on the point in the debug tree.
So you are trying to debug a maven project with goal "tomcat:run" in Eclipse and the application is breaking at the breakpoints set but you are getting "Source not found" error.
Follow the below steps to fix this:
Go to your debug configuration
In the Main tab, make sure you have "Resolve Workspace artifacts" checked
Make sure the Base Directory is set as your maven project
In the Source tab, make sure you have added your project as a "Java Project" or "Workspace" or "Project"
Step 4 is important, Add -> Java Project/Project and select your project

Maven multimodule projects linking in eclipse

I have a maven multi module project which has 5 modules. Some of my modules depend on one or more other modules, I am successfully able build the project and in eclipse also I am not getting any errors. However there is one problem which is bothering me, when i ctrl + click in my code and the class is defined on some other project eclipse does not open the file in the editor. I know i can attach the source code using maven but still i wont be able to make changes to that file.
Is there any way to be able to link projects in eclipse through maven?
Is there any way to be able to link projects in eclipse through maven?
That behaviour is the default. To check if for some reason that default is not in effect for your project, right click your project (the project you want to jump from) and go to "Maven". If there is an option "Disable Workspace Resolution" the workspace resolution is switched on, meaning you can theoretically jump from that project.
If you still cannot jump, then the project you want to jump to is not in your workspace. Take into account that for eclipse to identfy one project as dependency of another, everything including version must match.
Also check what rest_day said. You must have the projects importet as maven projects, but running eclipse:eclipse is not required anymore with current (up to ca 2 year old) eclipse.
Did you import the projects as Maven projects?
Also, could you go to the root of the project and run mvn eclipse:eclipse
eclipse:eclipse
Full name:
org.apache.maven.plugins:maven-eclipse-plugin:2.10:eclipse
Description:
Generates the following eclipse configuration files:
.project and .classpath files
.setting/org.eclipse.jdt.core.prefs with project specific compiler settings various configuration files for WTP (Web Tools Project), if the parameter wtpversion is set to a valid version (WTP configuration is not generated by default)
If this goal is run on
a multiproject root, dependencies between modules will be configured
as direct project dependencies in Eclipse (unless useProjectReferences
is set to false).
Instead of Ctrl+Click, click on the identifier and press F3. If you now see a red text reading "Current text selection cannot be opened in an editor", you've been hit by this bug.
See this question for a solution: How do I get rid of "Current text selection cannot be opened in an editor" in Eclipse?

Ant build won't run in Eclipse

I have an Ant build.xml which no longer runs when launched in Eclipse.
I click on the External Tools Configuration, select the Ant Build I've been running, and click Run.
Nothing happens -- no console window and the build doesn't appear to launch (the classes are not compile nor is the WAR file created).
I recently added a plugin (Spring IDE), this is the only thing I can think of that has changed recently as far as my Eclipse configuration.
I can run the Ant build fine from the command line.
Can anyone suggest where I might look to track down my error?
I'm using the Eclipse Helios release, Build id: 20100617-1415 on Windows XP.
As per pstanton's comment this symptom will occur if your ANT_HOME folder is not correctly defined in Eclipse. Eclipse seems to ignore the ANT_HOME system property.
window->preferences->ant->runtime->Classpath Tab
I faced same problem today , reason behind this was ANT_HOME path variable explained in other answers also.
Initially I added ANT_HOME at 2 places given below and it was not working.
window->preferences->ant->runtime->properties Tab
window->preferences->ant->runtime->Classpath Tab
But when I remove Classpath tab ant home entry ( by setting it to default using Restore default option on right bottom of preferences window ) it worked :). So far it is just a surprise for me because I added same ant home path at both the places.
You can check out the example in this Apache Ant tutorial.
But you can also try to run your same build.xml ant files through a Java Launcher, with org.apache.tools.ant.Main as the Main class.
That would at least prove your scripts are working in an Eclipse environment.
When you look at the Ant FAQ, you also see:
I installed Ant 1.6.x and now get java.lang.InstantiationException: org.apache.tools.ant.Main
The cause of this is that there is an old version of ant somewhere in the class path or configuration.
Maybe your error message is somehow hidden, but it can be worth checking your classpath and see if no other ant library is there.

eclipse debugger: attaching source-code of maven dependencies?

I'd like to use the source code of maven-managed dependencies when debugging our webapp in myEclipse 8.
I have managed to attach the sources to the libraries in the "Maven Managed Dependencies" classpath container, i.e. when I open a class file from a dependency (e.g. using Ctrl-Shift-T), I see the source code.
However, when I define a server connector for my tomcat, deploy the wepapp to it, and launch it in debug mode and execution halts on a breakpoint in that same class, the editor pane only displays the text "source not found", and a button to edit the "source lookup path". I have attempted to manually add the "Maven Managed Dependencies" classpath container, only to be told "Use maven project settings to configure depedency resolution". However, I see no useful setting in that property pane ...
How can I attach those sources? I am aware that this works with the m2e plugin and wtp, but I'd rather avoid convincing the rest of my team to switch plugins ...
Looks like issue MNGECLIPSE-983
I have confirmed that if I manually pick the External Archive option and find the relevant -sources jar (navigating that big .m2/repository tree to find it) and then add the jar as a sources it does work, and surprisingly it does remember the next time which isn't too bad.
That's at least doable I think for me because we don't often need to step debug through external dependencies, but when we do, it's often frequent, so adding it once while a bit of a pain, can be done on a case by case basis.
I have since discovered that this problem only occurs if the server is launched using a launch configuration.
The problem does not occur if the server is started by:
click the server icon in the toolbar -> context menu appears
mouse over the intended server -> submenu appears
click on "Start"
While this precludes sharing the server configuration by checking the launch configuration into version control, it at least allows seamless debugging.
Please do the following steps in Eclipse IDE(Tested with Version: 3.5.2),
In Package Explorer, Right Click on the Project which integrated with Maven container.
Select Maven 2 and then select "Fetch Source JARs".
The above action wil fetch sources of all the 3rd party jars present in the Maven Classpath.
Regards,
Rajesh.
Just put the .m2/repository/ folder itself with the search subfolders option.