I am trying to run an executable jar file through jenkins. What I am trying to achieve here is I have an executable jar file created and is residing locally in my machine. I want to put it in Git and then run it in jenkins. Is there some how I can do this? I am totally new to Jenkins and if someone can help it will save me a lot of time.
You can do nearly everything you want with Jenkins since you can have it run arbitrary scripts / executables.
If you want to put this .jar in git, then the Jenkins jobs will retrieve it when it fetches the repo. Then you just need to add a script shell step to the build, and to put your command line java my.jar my.class ....
On the other hand, it's sometimes frowned up to put binary files in git. It's true in particular if the .jar will need to be often updated. Hence you might want to provide the .jar to the Jenkins job using alternative methods. For example using a maven repository.
Related
I have a question according to automate my project lifecycle.
Now i do this manualy:
build my project with Ant, get target jar, rename it manualy (add
suffix, like version2.0-myProject.jar);
connect to remote server via ssh, open FreeComander and copy jar
file and INI-properties files to different folders on remote server;
Remoutly run my application throws putty (exec bat file on server,
which contain all cmd run command. This .bat contain plink.exe remote command to Lunux server, whoes contain instance of app).
What i want to do:
i want to automation deployment procces, include build phase and app run phase,
i want to do this:
When buld executed, user asked for output-jar file suffux(like varian2-myapp.jar), ask user for properties file with what programm will execute later, and ask user for Allocated memory for JVM (now it is part of cmd comand in .bat file)
My app is simple, contains 15 Classes and 3 external libs. I want to make deployment easy and automate this process, i learn that Maven or Ant Build can help me. Please say, what way is more comfort for my task of using this build systems.
With Maven you can use the Maven Release Plugin to deploy your package (which could be a zip with your jar and other dependencies for example) to a Maven repository (which you could be running in one of your server).
This page should get you started:
http://maven.apache.org/maven-release/maven-release-plugin/
With Ant, you can use Apache Ivy instead:
http://ant.apache.org/ivy/history/2.2.0/index.html
You then need a way to tell the server serving your app to pull the package and start using it (install it).
You could write a simple script that pulls the repo, which you trigger remotely, maybe using
plink -m
as you are doing now, or use one pre-built automation software, like https://puppet.com/.
I am having a QA Automation framework for an web application using selenium and java,testng in Eclipse as a maven project.
I am using cvs for code versioning among the team.
I need to deliver the updated latest code to the manual testing team for usage. They just change the testdata, and execute the corresponding scripts using the .xml files(Test files are kept in xml files).
Is there a way/tools which hides my code from them?
Compile your code and export as a jar file, which contains only the .class files
Create a batch file, which executes your driver script as required
Yes you can do this,
Use a batch file to run your program
Create a txt file and copy below code:-
java -cp ./ws.jars/*;./bin org.testng.TestNG testng.xml
In above code ws.jars is a folder which contain all jars which is being used in your project.
Now rename the txt file and change it's extention as .bat.
after click on it bat will run classes according to your testng.xml file.
You can also delete the src folder as TestNG need only bin means class folder.
While I am afraid you can't do same with maven as maven use src/test folder for execution.
Hope it will help you :)
It sounds like you should possibly set up a build server such as Jenkins. This will allow you to link your CVS to Jenkins. It will also allow you to let the manual testers pass in any parameters via the Jenkins GUI.
This will keep your code hidden (within reason) although hiding code from the QA team doesn't seem like the best approach. If you are the person in charge of the Jenkins server, it will also allow you control of who has access to the server and also who can execute and run the tests.
I have a job on Jenkins that compile an *.exe files .
Using "Copy To Slave Plugin", i manage to copy to job Workspace the files after compilation.
The URL is like that: job//ws/output/.
I want to use another job in a different slave that get this files and execute them there, this job is written in java (running with maven).
I couldn't find any Example of 'how to get file from jenkins master'.
There is anyone who knows how to Receive this files, or you have maybe other proposal how to inject the files directly from one slave to another (trigger by Jenkins of course).
Thanks a lot.
Using Jenkins to run my test suite. As part of the setup for an integration test, I need to copy a bunch of files into a given folder. I'd like to include these files in src/test/resources, and then somehow unpack them and copy them onto the folder before running the test. What's the best way to accomplish what I'm trying to do?
Edited to add :
Basically, I'm testing a method that needs to read some files from a folder on our hadoop cluster. On my Jenkins box, I have a single-node hadoop "cluster" running in pseudo-distributed mode. Thus, I need to copy those files onto the cluster before running the test. So I need to :
A) Somehow get the files onto the Jenkins box (I was thinking it would be easiest to package them in the JAR) and
B) Copy those files onto the hadoop "cluster".
First thing you should do is to set the option in jenkins job so that your workspace is not cleaned up on every run. This will esure that folder structure is intact before you start the build.
Use the plugin https://wiki.jenkins-ci.org/display/JENKINS/pre-scm-buildstep
You can add a step before you start the build copying and unpacking [basically it will provide you unix shell to execute any commands, so its you can do anything like ftp,rsync, unjar here].
But i am not sure how will you direct your test case to use these new files, but then i have never worked on hadoop so can't comment on that.
I have a Maven project which includes in the resources a set of database scripts relating to features which have been implemented.
I've created a separate Maven project which produces a jar file used to create a diff between the database scripts and what has been implemented in the database. This executable takes a command line argument which specifies the database details and the output path for the diff file.
What I'd like to do (and I'm open to suggestions on whether this is the best way to tackle this) is to include the diff jar in my project and to execute a goal from Jenkins which executes the jar and stores the diff file as an artifact of the build.
Could anybody suggest a way to do this as I'm not too familiar with Jenkins.
If this is a jar you can execute, you can just use the java exec plugin.
Once you've got that working to generate the output then you need to set up maven to run the command line that generates that output. This is pretty straight forward. Just add it as a build step.
Then to make it available as an artifact, tell Jenkins to archive the artifact by pointing it to the path of the diff.