Sample Project Import in WSO2CEP Developer Studio fails - eclipse

I have just installed eclipse-luno-with-developer-studio and in need to make some changes in already created samples in wso2cep like the very first one, http but it isn't importing those samples. I can run those samples using
ant -Durl=http://localhost:9763/endpoints/httpReceiver -Dsn=0001
but I want to modify the source and try again. For that when I searched, I found above IDE but its not accepting these samples as project when I try to import it. Anyone with a clue?

Please refer importing ant build.xml in eclipse.
Open Eclipse, select File > New > Project
Select "Java Project from Existing Ant Build File"
Show your build file and write a project name
For step 3, select the build.xml file related to the sample-project which you're trying to import.
For example, if you're trying to modify the HTTP producer, then you can point to following ant build file:
<CEP_HOME>/samples/producers/http/build.xml

Related

Need some help importing & rebuilding a Github java project

I am attempting to make a little tweak in the source of a GitHub java project and to rebuild it back into resulting .jar file to run.
On the project's URL, README says Download the source and build with gradle.
Downloaded using Clone or download button, extracted
Installed Eclipse 2019-12, then > File > Import > Gradle > Existing Gradle Project..., which gave me
Opened the .java file in the editor to make any tweaks
Now I need some help understanding how can I test and rebuild so I end up with '.jar' file to run? (The GitHub project's already built original .jar files are here)
Would appreciate to learn what further steps to take towards that.
Can you try using gradle wrapper (https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:adding_wrapper), this may resolve the build issues.
Here's how I finally got it working in Eclipse (Windows), thanks to help by emmanuel-chebbi (See detailed discussion in comments below the question)
Created a Windows environment variable JAVA_TOOL_OPTIONS value -Dfile.encoding=UTF8 ( See this )
The file Commons.java in the project also needed to be changed to UTF-8 NOBOM (just UTF-8 not good for Windows!) So did that ( See this )
Imported the project and overridden Gradle 3.0 to be the default ( File > Import > Existing Gradle Project > select dir > next > override > specific gradle version 3.0 > next > finish )
Any code changes as desired, if any (beyond this question's scope)
Ran default Gradle Tasks ( Gradle Tasks Tab > right-click project > Run Default Gradle Tasks )
Two JARs generated in \distrib folder
By the way, meanwhile I have also been trying to get a non-GUI IDE based solution with Gradle 3.0 command line to work, thanks to suraj-muraleedharan, and will update here if I get anywhere with it. (It's good for me to know there's a direct way than GUI IDE, but at this point, I just want to keep it simple for my limitations' sake — so accepting this as answer since it was posted as an Eclipse question anyway.)
Thank you both for your kind help and patience!

How to use SVN to build a library

I am trying to follow a tutorial, and I am told to:
1- Get the source code for the Java EMV Reader library from http://code.google.com/p/javaemvreader/ and build it.
2- Drop the resulting jar file in lib/.
3- Import the project in Eclipse and build it.
I right click the java files, and choose run as but don't get an option to run as Java Application. I also can not export the files as a JAR file. I have enclosed an image of what I have
After the first comment, I right clicked on my project, and under Maven, chose the option "configure as Maven" project. ( Thank you so much; this must be one of the fastest resolutions in the world )And I can now run the project. I get the window in my pic2, which I have attached. I don't however know what step 2 of the above instructions means. I don't see a lib/ folder. And the project he is refering to in step 3 is on git. Any ideas on what he means? ![pic2]!1
Eclipse projects have a "type" and that controls what tools are available. You probably created a "Basic Project" which means there are no compilers or other Java tools associated with it. You would want to create a Java Project in Eclipse.
That project does not seem to have Eclipse .project and .classpath files checked into the repository. It does look to be a Maven project however. So you would either want the m2eclipse plugins installed, and check this out as a Maven project, which would handle configuring everything else, or you want to use the Checkout As ... option and use the wizard to create a new Java project to checkout.
These are more Eclipse IDE questions than SVN or Subclipse questions.

How do I open the GWT samples in eclipse Helios and GWT 2.1.1?

What is the straight-forward way of importing one of the GWT samples in eclipse Helios + GWT 2.1.1. It seems like the content of the zip file doesn't contain any project files for eclipse.
I tried the following:
create a GWT project 'bla'
Delete the src ad war folder and
replace it with the src and war
folder from the sample
refresh the project in eclipse
hit 'run'
[ERROR] Unable to find
'bla/bla.gwt.xml' on
your classpath; could be a typo, or
maybe you forgot to include a
classpath entry for source?
So I go to the run configuration and remove the path for the example projects from the arguments list. I also changed the name of hosted html page to the one in the sample. Hit 'run' and:
[ERROR] Invalid version number "2.0"
passed to external.gwtOnLoad(),
expected "2.1"; your hosted mode
bootstrap file may be out of date;
Now I need an out of date version of GWT to run these samples? What is going on, I just want to look at a sample to learn a new concept.
Reading the readme.txt in the GWT samples directory I came across a solution that works on Eclipse 3.7. Assuming you have ant installed on your machine, execute the following from the sample's directory:
ant eclipse.generate
This will generate both the .classpath and .project files needed to import the sample into Eclipse and run it.
Here the relevant excerpt from README.txt:
-- Option A: Import your project into Eclipse (recommended) --
If you use Eclipse, you can simply import the generated project into
Eclipse. We've tested against Eclipse 3.4 and 3.5. Later versions
will likely also work, earlier versions may not.
If the directory containing this file does not have a .classpath or
.project file, generate them by running 'ant eclipse.generate'
In Eclipse, go to the File menu and choose:
File -> Import... -> Existing Projects into Workspace
Browse to the directory containing this file, select "Mail".
Be sure to uncheck "Copy projects into workspace" if it is checked.
Click Finish. You can now browse the project in Eclipse.
To launch your web app in GWT development mode, go to the Run menu and
choose:
Run -> Open Debug Dialog...
Under Java Application, you should find a launch configuration
named "Mail". Select and click "Debug".
You can now use the built-in debugger to debug your web app in
development mode.
In eclipse 3.7, instead of Run -> Open Debug Dialog..., its Run -> Debug Configurations. I got both the showcase and mail samples running following those commands. Should work for all of the other samples as well.
The examples that come with GWT SDK were built in different ways. Some are Maven builds, others use Ant. Eclipse can handle these common builds directly, but you have to choose the right option.
So, if you want to open the Expenses project in eclipse, you would look in the projects root directory (i.e. ../gwt2.4/samples/Expenses) where you'll find a file called pom.xml. That is a Maven build file. To import it into your Work space select:
File->Import...
Open Maven->Existing Maven Projects, and click on Next > button
Browse your file system til you reach the Expenses folder. Click on it and Select OK.
At this point it will show you the Projects in that directory in the Projects: area of the window...only one in this case: /pom.xml com.google.gwt.sample.expenses:...etc.
click on the checkbox for that project, Next>
Finally, it ask you to map plugins. You'll need to select in the drop down menu under Actions the required plugins (such as m2e).
In other project folders you may find a build.xml file instead. That's an Ant build file. To import that you do something similar, but different (of course!):
File->New->Project...
Open the Java folder and select "Java Project from Existing Ant Buildfile", Next >
Click the Browse button, dig through your directory to the project folder and select the build.xml file, and Open it.
Project name should fill in automatically, just select the declaration to use in the middle window and click Finish.
Since those tutorial only include the src and war directory, the idea remains to:
create a new project following this tutorial
remove any created class part of the example files which are automatically added (see Issue 1547)
Unfortunately the Google Plugin does not allow to created a new Web Application Project without creating template files. The template files are nice for the first try but annoying if you want to start from scratch with a new GWT application.
copy the src and war directory in place within the now empty project
Following your ticket 5847 (No easy and straight-forward way to make examples work in eclipse),
as xo4yhamope comments, you need the right GWT option.
and did you consider the Issue 5038 about the error message:
Unable to find 'xxxx.gwt.xml' on your classpath;
could be a typo, or maybe you forgot to include a classpath entry for source?
This message usually means you attempted to refresh the browser before dev mode has had a chance to finish loading the module.
The uppercase/lowercase confusion happens because the module has been renamed to 'stockwatcher', but dev mode cannot map 'stockwatcher' to "StockWatcher' until it has finished loading the entire module.
So, it's just a matter of waiting a few seconds longer after the Development Mode pane says I should go to http://127.0.0.1:8888/StockWatcher.html?gwt.codesvr=127.0.0.1:9997 ?
That seems a little messed up. It should wait until it's actually ready before telling me it's ok, because users (like me) are going to go there as soon as the UI says it's ready.
The other confusing part is that the server begins serving the host page as soon as that message in the UI comes up. Because this was happening, I assumed that the server was completely up, even though (as it turns out) it wasn't.
Anyway, waiting a few more seconds seems to resolve the "Unable to find 'stockwatcher.gwt.xml' on your classpath" problem. Thanks!
I'm beginning to suspect this is a bug in the samples. I am adding this answer so it can be marked as an answer when I get confirmation about that.
I was trying out some other samples and came across this page. At the top is a little explanation for how to download and import the sample.
Before you begin
The StockWatcher project
This tutorial builds on the GWT
concepts and the StockWatcher
application created in the Build a
Sample GWT Application tutorial.
If you have not completed the Build a
Sample GWT Application tutorial and
are familiar with basic GWT concepts,
you can import the StockWatcher
project as coded to this point.
Download the StockWatcher project.
Unzip the file.
Import the project into Eclipse
From the File menu, select the Import... menu option.
Select the import source General > Existing Projects into
Workspace. Click the Next button.
For the root directory, browse to and select the StockWatcher
directory (from the unzipped file).
Click the Finish button.
If you are using ant, edit the
gwt.sdk property in
StockWatcher/build.xml to point to
where you unzipped GWT.
Now this is what I call straight-forward and easy.
At that point I had already built the StockWatcher in a previous tutorial but I got intrigued by the fact that it was explained exactly as I tried it the first time. So I downloaded the project and it had the correct eclipse project structure. I tried to import it 'et voila' I have the project in eclipse. I runs out of the box (with warnings). That is how expected the samples to be.
This experience leads me into thinking that the sample projects are malformed (as eclipse projects) and need to be updated. Let's hope my issue report leads to results.
-- Option A: Import your project into Eclipse (recommended) --
If you use Eclipse, you can simply import the generated project into Eclipse.
We've tested against Eclipse 3.4 and 3.5. Later versions will likely also
work, earlier versions may not.
If the directory containing this file does not have a .classpath or .project
file, generate them by running 'ant eclipse.generate'
In Eclipse, go to the File menu and choose:
File -> Import... -> Existing Projects into Workspace
Browse to the directory containing this file,
select "Mail".
Be sure to uncheck "Copy projects into workspace" if it is checked.
Click Finish.
You can now browse the project in Eclipse.
Copy from readme.txt supplied by samples. I tried this method, it's OK.
To import GWT showcase(2.5.1) I did following steps:
Create a new Google Web Application Project
New –> Other –> Google –> Web Application Project
Provide the project name “Showcase” and the Package name is com.google.gwt.sample.showcase
Click Finish
Go to eclipse plugin folder and traverse to the gwt
Under that folder go to gwt-2.3.\samples\Showcase
Copy (Ctrl C) all the contents. The contents are
a. src
b. test
c. war
d. build.xml
e. README.txt
In the eclipse, right click on the Showcase project and paste. Overwrite all the files
The files should start copying without any problem
Right click on the Showcase and Run As “Web Application”
You should have your Showcase working like Gem!
For me it worked like a charm ;)
Ref : http://simplestepswebdev.wordpress.com/2011/05/16/import-gwt-samples-into-eclipse/

Eclipse Generated Build Files

I am using the ZK Studio plugin to create a web based project based on the ZK framework. Now, in order to deploy this project, all I do is right click on the project and select "Export" then select "WAR file". However, I would like build files to be created so that someone else can just make a change and run the build file to re-compile and create the WAR file automatically. I have been told that Netbeans does this automatically, and it seems so does eclipse since it allows me to just say "Export as WAR". However, I need to commit build files to the svn as well. How can I get this option through eclipse?
Thanks!
P.S. I have seen this question:
Generating Ant build file for a project in eclipse
But I do not have that option when I right click for some reason.
Select build.properties file in project explorer view and from context menu (right click) select PDE Tools -> Create ant build file.
Same can be achieved through an ant task as well. See http://help.eclipse.org/helios/index.jsp?nav=/4_2_0

gwt> importing a sample project

I'm just barely after 2 hours of trying to force it to work and looking for answers online.
How in the world do you import a sample gwt application into your eclipse and make it run?
by the way, I cannot find "projectCreator.cmd" anywhere in my files, where is it suppose to be assumming i've used eclipse plugin updater to d/l gwt 1.7.1?
Well, this is what I ended up doing though it ugly and probably not how it was meant to be:
I create a new application called it "bla" or whatever
then right on project > import... > general\file system... (as in import files into projects)
then I selected the top folder of one of the sample applications, for example ..gwt..samples/Mail
selected all folders and files.
selected option "override without warning\asking"
de-selected option "copy entire folder structure"
that's about it. I went to build.XML to rename the project name to "bla" and then I clicked run as a web application.
good luck.
For GWT 2.4: In every project's root you will find a README.txt. If you follow its directions (involving creation of Eclipse project configuration via Ant) you can import the project easily. To run it I additionally had to configure the project's GWT settings (project's context menu -> Google -> WebToolkit settings).
First, Create an Eclipse project for your source, if you haven't already done so, by selecting File > New > Java Project. Then choose Create project from existing source and set up your project. At this point, your source will be loaded in Eclipse, but the project's build path may not be set up properly, and you may see build errors.
Alternatively, if your application's source tree already contains a .project file, either because you had previously worked on it in Eclipse or because it was generated by a tool like GWT's webAppCreator, you can import the project by going to File > Import > General and selecting Existing Projects into Workspace
To enable Google Web Toolkit, right-click your project and select Google > Web Toolkit Settings. Check the Use Google Web Toolkit box and click OK to apply the change.
Enabling App Engine for your project is similar: right-click your project and select Google > App Engine Settings. Check the Use Google App Engine box and click OK.
Source : https://developers.google.com/eclipse/docs/existingprojects
What I did to start it:
My workspace is at: /Users/ievgennaloiko/Documents/helpdesk/
I have downloaded the gwt to Downloads folder. Extracted it. Navigated from terminal to samples and run
ant eclipse.generate
for each sample project I need to import to Eclipse. Even you can run this command on whole sample project.
Next I've copied the samples folder to /Users/ievgennaloiko/Documents/helpdesk
Started Eclipse.
File import -> Existing proj into ws -> /Users/ievgennaloiko/Documents/helpdesk/samples/DynaTable
Copy project into ws - Unchecked.
Next I had to go to properties of the project Google-WebToolkit->Use web toolkit.
Here are the arguments I run with, check for correspondence:
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -port
auto - codeServerPort 9997 -war
/Users/ievgennaloiko/Documents/helpdesk/samples/DynaTable/war
com.google.gwt.sample.dynatable.DynaTable