How To Configure Ant Plugin For Jenkins - plugins

I have marathon Project where I have buid.xml which has many targets all are runned with the help of ant tool. but in the jenkins I need to select a target which I only need to build and test. I need to know how to achieve this using parameterized and invoke Ant ???
Can any one help to me !!

Here is another question which deals with sending parameters to Ant builds.

Related

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

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.

How to do a clean build in eclipse and run a junit test case at startup?

Is there any way we can clean all/rebuild the projects in eclipse and run a jUnit test case every time we open eclipse?
I am developing an eclipse application. The scenario is that i want to schedule UI tests to happen automatically twice everyday. But i do not have an executable build as such. But have the full code base with me and i want to run some scheduled JUnit test cases(based on WindowTester) on it.
Any other ideas that you have is also welcome. :) Thanks in advance.
Ant requires a executable build to perform the tests on it from what i have read. :(
Regards,
Thomas
Tough Jenkins is opensource, Going for jenkins will be a good choice if you have more number of projects to manage. Jenkins dose lot more than automated test case and builds.
But, If you have a small code base and need to peform some specific tasks like
scheduled build and test cases, ant build will is much preferable.
In your case for running test cases,
Create a ant build script to build the entire project (How to write Sample Build scprit)
Create another ant script to read the jars and execute them using the tag (How to write Sample Test Build)
Write a bat file to call the ant scripts and Schedule build twice a day in windows scheduler available in control panel.
SO, this will compile, build your project and test it in scheduled time. Just trigger a mail from the ant script if test fails.

Deployment of Bndtools Projects in Hudson

Since I am a big fan of developing OSGi with Bndtools. I want to use it for my new project request as well. But one requirement is that all build processes should be done by Hudson.
My question is how I can achieve that I can use Hudson connected to my Bndtools projects? Maybe someone has a step-by-step tutorial for me :) Furthermore, will Hudson use OBR to resolve the dependencies like Bndtools is doing? How should such a deploy process look like? Btw Bndtools has its one "Integrated Test" project environment where it starts an OSGi environment in the background. Will Hudson understand such kind of tests?
What is best practice to use as much as possible of Bndtools?
Thanks for any help.
Christian
I found a way by just iterate with a custom main build.xml through each projects build.xml. I works and it's nothing special.
Create a new build task in hudson and define there ant build steps rather than introducing and maintaining a new build file.
Create for each project an ant build step.
In my case I created a task named BuildAll which has several ant build steps in it.

Howto protect an ANT task / target from accidental execution?

I have written an ANT script which deployes an application to my local development Java EE enviroment. I need the same function to deploy it to the productive enviroment.
I often only want to deploy to the development server and rarely to the productive one. I'm using Eclipse IDE. Depending on the way ANT is used, it could happen, that I accidantally deploy to the productive server, with just one wrong click.
What is the best way, to build this functionality that way, that I could not deploy accedantally to the producte system?
Two separate ANT scripts?
Twoseparate ANT targets?
Is there any password protection for
ANT tasks or targets?
Any other way?
Require a property to be set for the production deploy, and then only deploy to production from the command line (with -DreallyDeployToProduction=true or whatever).
Maybe first add for some extra input, so you have to click and press enter?
Since ant 1.7, there is an input task
I vote for separate Ant scripts.

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.