I am trying to learn Jenkins and Git. I have created a simple Freestyle project which takes a simple source code below from git and and prints Hello, World. The Hello_java file commits to git fine.
public class Hello {
public static void main (String [] args) {
system.out.ptintIn ("Hello, World");
}
}
The console output gives error below
Error: Could not find or lead main class Hello
what I am doing wrong?
CodePudding user response:
This error comes when there is a problem with the .class file. To run this program, you need the .class file that is created when you compile the .java file. Have you compiled it (or gotten Jenkins to compile it for you)? If not, you have to do:
javac Hello.java
Then, you should be able to run:
java Hello
And everything should work.
CodePudding user response:
- build
As later steps you want to see what to do with the deliverables obtained (.jar .war files etc) . You can pack them and download from jenkins (easiest), store them in a repo (like artifactory/nexus) or build a container image with the server running that jar and push it to a docker repository (private dockerhub, gcp, aws etc) .
Note: jenkins server should have docker installed in order to get maximum flexibility from it.