This post talks about how to create fundamental job and how to build in jenkins by taking a HelloWorld java program.
Environment : Windows 7, Jenkins 2.60.1
Below are the steps to do.
1) Open jenkins dashboard : http://localhost:8080/
2) Create a new job by clicking on "New Item".
3) Enter a name for the project/job lets say "HelloWorldJob" and chose "Freestyle Project"
4) Navigate to "Build" tab and then select "Execute Windows batch command" and write below to commands to execute the java HelloWorld program that we will put in the job workspace in next step
Click on Apply and Ok to save the job.
javac HelloWorld.java
java HelloWorld
5) Put HelloWorld.java file in Project workspace
Location of workspace: C:\Program Files (x86)\Jenkins\workspace
NOTE : Unless you build the job at least for 1 time, the jenkins engine will not create job/project workspace in above location
So, build the job for the first time without the HelloWorld.java file to get the workspace created.
Click on "Build Now" as shown in below
Check whether the workspace is created or not
6) Now, put "HelloWorld.java" file in "HelloWorldJob" workspace
8) Now click on "Build Now" to run the job
The light blue indicates the job ran successfully.
9) Now, click on "Console Output" as shown in below to see the output of the build
10) Console output
References
https://stackoverflow.com/questions/15020034/how-to-compile-and-run-a-simple-java-file-in-jenkins-on-windows
Environment : Windows 7, Jenkins 2.60.1
Below are the steps to do.
1) Open jenkins dashboard : http://localhost:8080/
2) Create a new job by clicking on "New Item".
3) Enter a name for the project/job lets say "HelloWorldJob" and chose "Freestyle Project"
4) Navigate to "Build" tab and then select "Execute Windows batch command" and write below to commands to execute the java HelloWorld program that we will put in the job workspace in next step
Click on Apply and Ok to save the job.
javac HelloWorld.java
java HelloWorld
5) Put HelloWorld.java file in Project workspace
Location of workspace: C:\Program Files (x86)\Jenkins\workspace
NOTE : Unless you build the job at least for 1 time, the jenkins engine will not create job/project workspace in above location
So, build the job for the first time without the HelloWorld.java file to get the workspace created.
Click on "Build Now" as shown in below
Check whether the workspace is created or not
6) Now, put "HelloWorld.java" file in "HelloWorldJob" workspace
public class HelloWorld {
public static void main(String args[]){
System.out.println("I'm dancing");
}
}
7) Now, if you look at, in jenkins dashboard, the file is loaded in the job workspace.
The light blue indicates the job ran successfully.
9) Now, click on "Console Output" as shown in below to see the output of the build
10) Console output
References
https://stackoverflow.com/questions/15020034/how-to-compile-and-run-a-simple-java-file-in-jenkins-on-windows
No comments:
Post a Comment