Referencing a GWT project from another GWT one - Problems - eclipse

I am already using an open source GWT project (iServe) and I would like to integrate into it another open source GWT project (PetalsBPM), by which I mean being able to call it and reference its methods.
I have imported iServe in Eclipse (it has multiple modules) as separate Maven projects referencing its other and can run it successfully through Runas -> Web application in development mode.
If I do that and run the other project through the console as mvn gwt:run, I call initiate PetalsMBP through iServe. However, that means that the two programs have to run as is, without communication with each other.
I have also imported the second project into eclipse as a java project successfully (converting into a Maven one causes problems - various lifecycle configurations ones), but whenever I try to add to to iServe through Properties -> Java Build Path -> Projects, although it does not cause any errors immediately, I cannot launch iServe anymore. It produces the following error:
"Exception occurred executing command line.
Cannot run program "C:\Program Files\Java\jre7\bin\javaw.exe" (in directory "C:...iserve-sal-gwt-1.0.0-SNAPSHOT"): CreateProcess error=206, The filename or extension is too long"
Are my problems related to the fact that PetalsBPM is not a Maven project in Eclipse (I doubt it)?
Am I doing something wrong, i.e., this is not the way to reference a project from another one? should I add a reference to the first project's (iServe) gwt.xml file?
Is there a way to do what I want without having to wrap the second project as a jar and calling it from iServe? I would prefer not to, since producing a jar every time I make a slight change is not exactly efficient!
P.S: The second project is a regular GWT project with an entrypoint, not just a module. Should I remove this?
UPDATE: Trying to figure out the source of this error, I attempted to simplify the problem, so I performed the following moves:
I created two new simple GWT projects and tried to reference one
from the other. Worked fine
I referenced the project I actually want
to use (PetalsBPM) from the simple one I just created. Also works
fine.
I referenced the new simple project from the original one I
want to use (iServe). Also works fine.
Tried doing what I actually
want to do, copying the settings from 2&3. Produces the same error
"CreateProcess error=206, The filename or extension is too long" if
I reference PetalsBPM (does not when I remove it from the referenced
projects)
So, I tried switching workspaces. I created a new workspace in C:\, and moved the actual projects there. Still it did not work. :(
Any more ideas?

I met the same type of error "Create Process, error=206, path too long etc." a hundred times.
Then, I found a solution/explanation in google-groups, it solved my problem.
I post the content and link as it might help others.
This website (StackOverflow) really helped me a thousand times.
Thanks to you all !
solution/explanation :
(Response from Stephen Johnson)
(...) if you're using eclipse plugin go to Project | Properties, choose
Google \ App Engine \ ORM and only include directories that you have
classes that you want enhanced. By default it does the entire project
so that includes a lot of needless files. (...)
Link :
original post # google-groups

Read the exception message again. Somewhere along the way Maven is generating a path that is too long for (some) Windows API to handle, try moving your workspace to a directory straight below C:\.

I just tried "skolima" reply and it worked for me. In Eclipse I clicked File->Switch Workspace.
Three things to note:
After I created the workspace in "C:\workspace" I had to update my Project->Properties > Java Build Path > Libraries > Add External JARs...
I'm using Windows 7.
I'm using "Eclipse Java EE IDE for Web Developers"
I hope this others.

Related

what is the right way of importing a maven project in Eclipse and run it as a Java project?

I don't understand exactly what is the way of working with maven projects in Eclipse.
The problems I have are often with projects I download from github. If I set the project myself it usually work, so I think I'm doing something different from the majority of people.
I'll try to detail a specific case:
I clone a repo, let's say: https://github.com/spring-guides/tut-spring-boot-oauth2
In Eclipse I import "existing maven project"
The project has a "Maven nature" as indicated by M on the folder icon
I try to run java class with main from Eclipse. First strange thins is that the "Run As" menu doesn't have "Run as a Java application"
I have to configure the configuration manually. Now it runs, but strange things happens, like I can't edit the file as the "content assist" throw errors instead of giving the normal assists.
I notice that the project has no "source folder". So my first instinct is to add a Java nature or select src as source folder
So I add Java nature to the project. This is a disaster. It can compile anymore as it can find packages. All classes have errors. I try to play around setting source folders on /src or /src/main/java. Sometimes I fix the errors but I can't run (and now I have run as Java application) but when I run it can't load the class
So in the end, I'm a bit confused and I don't know if I explained clearly what I'm doing.
I think I would like to know in a simple way how people are doing it, rather than trying to correct my steps as I'm probably creating a mess myself.
Any help or suggestion welcome.
I'm using the last version of eclipse. I don't know which other tool's versions are relevant.
P.S. I also refresh,restart,clean rebuild the project often after touching things...but it doesn't get better
Maven is a build (management) tool. Simply spoken, its task is to create a JAR that can be used as a dependency/library by other projects or when running java -jar ....
Running a project's code isn't part of it (apart from unit and integration tests code and by using non-default plugins for special situations). Running code is part of Eclipse (or any other IDE) with its Run Configurations.

Eclipse Scala IDE: can't open hierarchy for standard library classes

I have exactly the same problem as in this question: Eclipse: Using "Open Declaration" ... in a Scala project
However, I'm using the latest Scala IDE in version 3.0.2 (I have downloaded the Eclipse bundle from the site), and I would assume such basic functionality works by now, and apparently it's me who have something misconfigured.
I have created a new Scala project. Then I open some standard library class/trait/whatever, let's say scala.util.parsing.combinator.JavaTokenParsers. The source is neatly displayed, but when I try to show class hierarchy, I get the message: The resource is not on the build path of a Java project.
Also, searching for references etc. won't work.
I guess it is a matter of properly configuring the build path? Or maybe I should somehow attach Scala library sources to my project? But I can see the source, so aren't they attached already?
Here is the snapshot of my project configuration:
UPDATE:
By playing a bit with setting/resetting build path stuff, I managed to get rid of pop-up warning but the class hierarchy comes up empty and when searching for references I get only hits from my own sources, nothing from standard library.
In another workspace I also tried randomly adding and removing scala-library jars and got it work almost, but the type hierarchy comes up only with super-classes, without any sub-classes (which renders it quite useless). Searching for references works ok though.
Funny thing, I cannot make it work in my original workspace...
Gotta love Eclipse.
Your build path is not configured properly.
If you take a look under Scala Library[...] you have scala-library.jar we can only see one top-level package scala. There should be numerous other packages besides that. (Ruled Out)
I would recommend you follow these steps
Right-click project, build-path, Java-build-path, Libraries and make sure that the correct library is referenced there.
If it is the one you need, Try to remove this library and add it again, then clean and re-fresh the project. Also try this step in a fresh workspace.(something must have messed up this workspace )
Lastly. Goto the path D:\Eclipse For Scala\configuration\org.eclipse.osgi\bundles\286\1\.cp\lib and verify the sizes of the jars there. There should be 6 jars there and the size of scala-library jar should be around 6.8M. If size is smaller, consider re-downloading

Duplication of resource folders within an Eclipse Project

I am writing an Eclipse Plug-in which requires me to add two new configurations to the ManagedProject upon mouse-click on a menu option. I basically runs on Android projects that has Native Support Added to it. I am trying to achieve this using ManagedBuildManager and Configuration classes from the CDT core plug-in interfaces.(org.eclipse.cdt.managedbuilder.core.* package).
To complete the task, I create two new Configurations for the project and run the exportArtifactInfo() method to complete the action. In the end, the configuration gets added but the project folder contains duplicate folders of all the original folders in the Project folder.
I looked up if there is a bug in CDT 4.0 and found that it is indeed a resolved bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=194395
But I cannot figure out what the actual fix is for this bug. If anyone has encountered and fixed it or knows how to fix this, please point me in the right direction.

Another GWT module may need to be recompiled

I'll start with the other threads I've read:
GWT module may need to be (re)compiled REDUX
Some subtlety of GWT compilation - "gwt module may need to be (re)compiled."
Google App Engine - recompile GWT module
GWT Maven : Module 'xxx' may need to be (re)compiled
I have taken the following steps to fix this:
Cleared my browser cache.
Deleted gwt-unitCache folder.
Deleted *.nocache.js.
Deleted every file that was left over from a previous build. (I did this by looking at the date and time it was created.)
Run both maven clean and gwt:clean on my project.
Compile by right clicking on the project and going to Google > GWT Compile.
Run maven package.
Put the war in my JBoss EAP 6.1 (JBoss AS 7) folder.
Connect to it and still get the "GWT module may need to be recompiled" error.
What else could be causing this error to come up?
This has happened to me in the past when I imported a GWT project to a different computer. Seems you have already done some things I have tried. Before you start, right click on your project, hit Refresh, so you don't miss anything that's not in sync with the file system. There are multiple things it may be, so here's all the things I did to get it working:
Before the following steps also helps if you use the same version of GWT that was originally used to create your project. Also, make sure gwt-servlet.jar, gwt-servlet-deps.jar, validation-api-1.0.0.GA.jar, and validation-api-1.0.0.GA-sources.jar in your libs directory are the same as the ones from your GWT SDK directory (only if your app uses them).
Delete gwt-UnitCache
Open up the war directory.
Delete ALL compiled module folders.
Delete the war/WEB-INF/deploy folder.
Delete the war/WEB-INF/classes folder. It may be hidden in Eclipse, so you may have to do it via your file system.
Now, on the menus: click Project > Clean...
Make sure a build happens too. Either make "Build automatically" is selected, or use the option in the "Clean" dialog.
Do a GWT Compile. If you have more than one module, ONLY compile the main module. Any inherited modules will also be compiled.
I hope this helps. Ask if you need any clarifications.

Remote Play framework and Eclipse

I have a play framework project which run on remote server.
I'm trying to configure eclipse to work remotely on the project.
since no build is required my requirements are to be able to edit the project files from eclipse and automatically save on server, auto complete and debug.
I've installed Remote System Explorer on eclipse and setup a remote ftp connection to my server.
The play environment on my server is under
/play-2.0.2/
My project path is
/play-2.0.2/test
In RSE I clicked on /play-2.0.2/test and 'Create Remote Project'
Now in Java perspective I can browse through the project, change files and then automatically save to server.
My problem is auto completion of play framework library doesn't work well since all the reference are to /play-2.0.2/repository/...
any idea how to solve it? I tried to play with the build path but no success
Thanks!
So, I was looking into achieving the same thing myself.
The problem you are experiencing is due to the fact that the .classpath file has absolute values. While for me, besides the symlink that doesn't work between two different kinds of O.S., I thought on another two solutions:
Use sed to rewrite the classpath on the .classpath file after it's generated
Use a "classpathTransformerFactory" for the sbt eclipse command
I haven't had to deal with it (it's more of want to than whatnot) as soon as I do, I will explore the two options and post details. I just leave the answer here in case someone wants to pick up where you left.
Another thing is:
Seen that sbt picks up the libs referenced in build.sbt, downloads the jars and puts them in the ~/.ivy2 directory, if you use any of those methods to change the reference from the remote machine to the local one, you would need to make sure that the same libs are on the local ivy cache. So, just as I wrote this, another idea came to mind:
sbt eclipse or play eclipse or activator eclipse [it should be the same] on a local environment, and on the remote one, then, transfer the .project and .classpath files from the local to the remote, and see what happens (if it doesn't work, scan them for absolute and incorrect paths that might need to be changed)
Sorry for the unproved answer, still I think it's better than no answer.
Cheers