Scriptable Eclipse run/debug configuration [duplicate] - java

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.

Related

Run Maven Project (with ant) in a single go using Remote Debug Configuration of IntelliJ

I have a Maven Project, Ant Project which are somehow coupled. If I have to make any change in maven project and test it I have to do following steps every time, which is very time consuming.
Steps
ant stopserver
mvn install
ant startserver
Access it on localhost:8080
And to debug anything I have to create a Remote Debug Configuration which connects to port 8000 and start ant server in debug mode.
All this is new to me as I have only worked on microservices based out of maven when there is a #SpringApplication class with main method which I could directly run/debug. In this project, there is no class with main method. It's a legacy spring mvc project.
I seriously want some way to do the same with current project. I tried going though the build.xml but ant steps are hardly taken less than a second.
Is there a way possible? Can it run like a normal maven project? Ant is probably building some db and ui parts (not very sure). But I only work on Java side.
Please help. Anything that could get rid of me having to run mvn install with every small change would also be helpful. To reduce the time taken by mvn install I used the script from this answer here and added that as well, as one of the before launch steps but the time taken is still the same.
I have tried following post but it did not work for me How to build maven project with ant script?
Open the lid and find out what exactly ant startserver does, and then create a launch configuration in your IDE that does the same thing. You might be able to cheat a bit and investigate the process in the operating system using its tools to get the invocation commandline.
Then run that launch configuration in the Debugger and tell your IDE to tell the JVM to hotswap newly compiled classes.
You should now have a much improved experience.
You may want to take the opportunity to teach Maven how to launch your server as that might enable the IDE to pick this up directly.
I was able to achieve at least one click start by Adding ant targets as part of the "Before Launch" inside "Run/Debug Configurations". To reduce the time taken by mvn install I used the script from this answer here and added that as well, as one of the before launch steps.
By enabling Logs, this also became user friendly.
Here is how my config looks like now,
However, I still have to do maven install.

Copy compiled binary files to remote system

I'm developing simple Java application in Eclipse Oxygen. I would like to ask Eclipse to copy binary files to testing machine automatically when it builds. How to achieve that? How to run script on remote Linux machine that restarts application when binary is copied?
UPD
Since Eclipse builds project very often I would like to have Deploy functionality according to request. How to achieve this option?
Look at the 'Builders' page of the project 'Properties'.
You can add an 'Ant' script or a program to be run when the project is built along with the other builders.
Builders normally run quite a lot so you may want to turn 'Build automatically' off.
It is also possible to write an Eclipse plugin which contributes additional builder types - but that is more work.

Run Selenium Java Test in VSTS(Visual Studio Team Service)

I have written selenium java code to do the UI automation test in eclipse. Now, I want those code to be runed in VSTS. Problem is that there are lots of components which I am not clear how they are used under the tab "build & release". So I am looking for masters who can share with me the steps to achive my target. Thank you.
If the test need to be run in interactive way, you need to setup a build agent with Interactive mode. (e.g. Deploy an agent on Windows), then run test through this build agent.
There is the Maven task that can run java test.
A related article: Testing Java applications with VSTS

Validating a jar made by Eclipse outside of Eclipse

I have a Java application I've developed in Eclipse. To package it into a .jar, I simply run File->Export->Runnable JAR file with copy jar files into sub folder selected.
For deployment, I turn over the compiled jar file along with my source code and the deployment team packages it up and deploys it to our systems. One of the responsiblities of the deployment team is to verify that the source code that is turned over compiles into the binary that is turned over with it. This is the only Java program the deployment team works with so they don't have Eclipse available to import my source code and validate it against what I provided them. For the time being, they have just been taking my word for it, but that needs to change. They will need to compile the code on their own and make sure it matches what I've given them.
How would they go about doing this? I suppose one option is to get all of them up and running Eclipse, but that seems like an overkill. Is there something they can run outside of Eclipse without having Eclipse installed to generate a jar file that they could validate is the same as what I've provided?
Thank you for any assistance.
First, how can they tell that what you supplied "matches"? That doesn't really make sense.
What they really want to do is to build their own deployment artifacts from your source. They can either set up Eclipse and use that as their build tool, or you and they can agree to use a build tool such as Maven or Gradle. These tools integrate with Eclipse, but they are designed to run stand-alone or as part of a tool like Hudson or Bamboo, which will perform build on a schedule or when a VCS is updated.
A client used Maven and Bamboo, along with the rest of the Atlassian suite, to handle enormous builds based on contributions of more than 100 developers. That included running JUnit tests, test coverage, and code quality tools.

Which java server to run a jar application?

I made a java program which runs unit test on my website.
I need the unit test to keep running during the day while I watch the log.
For this, I search a java platform on which I can run my soft. Openshift will be the best because it's easy to install and maintain.
However I will often modify this soft and if the java project could be built whenever I made a commit it will be the best. That's why I think to Jenkins, but I don't know if it is a good way to run a jar from a jenkins server whereas it is made to do build.
I tried JBoss and tomcat by wrapping my programs into an Enterprise Application Client but I can not run and check the log of the program from a web interface.
Currently my project is a Java Application, using MySQL, hibernate, maven and git.
What would be the best option for you ?
Thanks.
Florian C.
Finally, here is my soluce.
I use Jenkins.
When I push on Jenkins, my project is automatically built and ran using a shell script.
If the build or the run fails Jenkins sends me the command output by mail.
Else, every day, the project is run (using the cron of jenkins) and the console output is sent to me by mail, so I can check the result of my test.

Categories