Run Ant files when performing Build and Deploy Worklight 5.x.x Application - eclipse

I have a Worklight application set up in Eclipse. Before executing Build And Deploy Worklight Application, I need to run a bat that compiles a bunch of HTML templates. This templates are necessary to run the app correctly.
So, I would like to know if it is possible to link (maybe under Run Configurations...?) an Ant file or similar that allows me to execute the bat and perform the build & deploy in an automatic way. Any advice?
Hope the question is clear.

I believe you can add an extra project builder to your application that invokes the Ant task you need.
Under Eclipse take a look at Project->Properties->Builders->New.
You will find Ant buildfiles as project builders a useful link.

Related

Running GWT application in production mode

I am newbie to GWT. I have built gwt maven project. To run in development mode, I first compiled project Google|Compile Project, then from command mvn gwt:run, it runs fine on
http://localhost:8888/index.html?gwt.codesvr=127.0.0.1:9997
but for production I want to access module
http://localhost:8888/index.html
When I omit gwt.codesvr= argument, I am getting error "gwt module may need to be recompiled". After Recompiling, I get the same error. Any help/pointer?
Thanks,
i run gwt project on tomcat on production mode. Jetty cant show it. Try to tun with external web module. When you are look at the IDE console title show us 'Development Mode'. Tyr with external , in any exception i can help.
You did it correctly, but as the error states, the module needs to be re-compiled (GWT Compiled). Once recompiled, Force your browser to reload (Ctrl + F5). If that doesn't work, you can look at this answer I wrote regarding cleanup of compiled output. Do what's listed there, and try running GWT compile again.
To run production mode outside Eclipse, you must do a GWT compile and create a WAR file, which you can then deploy on a Java application server such as Tomcat. This process is much easier with an ant build script.
To make an ant build script for your project:
You can easily create an ant build script by running the webAppCreator command from the directory where the GWT library is installed. That command will create a sample project just like clicking "New Web Application Project" in Eclipse, except it will also make a build.xml file.
You can run it in Eclipse by right clicking build.xml > Run As... > Ant build. By default it will run the build target. It also has a war target, which you can run to create a WAR file.
For more details on the webAppCreator, look here.

Exporting RCP as a product

I am deploying my eclipse rcp product into some folder say C:\deploy\eclipse.
But
Here i am facing a problem,while i was exporting to the same location it says export failed,
Since my project is in development stage each time i do changes in the code,i need to deploy to perform unit testing its pretty time consuming.All that i want to achieve is just override the same deployed location, i don't know if it is possible? The current approach was just go and delete the currently deployed folder and then export again, this is odd i guess, can someone drive me in a better approach
I suggest to setup a headless build which means that you're able to trigger a build of your RCP application from the commandline. Once you've established a headless build you can write some sort of batch file which for example cleans up the deployment directory before the build.
You can integrate this batch file in your Eclipse IDE via External Tools.
Here is a tutorial on how to setup a headless build.

Launch an Eclipse Run Configuration from ANT

I am using Orion server for my Java-based web application. I have a run configuration that launches Orion with the correct classpaths and all necessary configuration. I also have several ANT scripts for copying files to the build path. I want to create an ANT script that shuts down Orion, copies necessary files, and restarts Orion. I can shutdown and copy in ANT, but I can't figure out how to launch a run configuration. I prefer to reference the launch configuration as opposed to specifying all of the configurations in the ANT script as well. Is this possible?
With eclipse remote control you can launch eclipse run configurations in eclipse from a simple java client application.
Ant4Eclipse is an Eclipse plugin and looks like it can do what you are asking. I have never used it myself so can't guarantee but reading their documentation they say you can create an Executor task that works on your launch configuration artifact. You will then reference this task in your build file.

How to solve problem with out of synchronization of J2EE module dependency in Eclipse?

I have two projects : my-lib and my-web.
my-lib is built using the Java compiler of Eclipse, and a short Ant task is run on some properties files, which are then modified (as explained here).
This is not a pretty solution, but it works.
Now, as my-web is dependent of my-lib, I define my-lib as a Java EE Module Dependency of my-web.
However, when I attach my-web to the Tomcat in Eclipse, and try to publish, I get the following exception:
'Publishing to Tomcat at localhost' has encountered a problem.
Resource is out of sync with the file system: '/my-lib/target/classes/my-app.properties'
This file is indeed one of the files modified by the Ant task.
How can I correct this problem, as I need to have the Ant task run on the my-lib.
If you have the Ant task run as an external builder or external task, you can configure it to refresh the project, workspace, or selected resources after execution. When specifying the task/builder click on the Refresh tab and pick the appropriate one for your needs.
There's more information in the eclipse help.

How to run Eclipse launch configurations programmatically?

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.
I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.
What would be the best way to run a .launch file outside of the UI?
Edit: I am trying to unify the tests run on the build server and the IDE. I do not
particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .
This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.
there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps
Ant4Eclipse may provide a good starting point on how to do this.
Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.
I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.
After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.
You could also use the shell command Eclipse uses. To get it:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash
I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.
This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.
Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.