Deepu Nair
Deepu Nair

Reputation: 165

Jenkins & Java : How to specify input file location

I have a java project which compares data in two excel files and displays the output. IN my eclipse project i created a folder data and in the code I wrote code read from root/data and it works fine as well. But my manager asked me to move this job to Jenkins. So my question is how do i specify the input folder path in Jenkins , Should it be the same server where Jenkins is installed or Jenkins can read data from another location in another server ?

Upvotes: 2

Views: 4002

Answers (1)

Eytan Avisror
Eytan Avisror

Reputation: 2970

By default, Jenkins will work on the Job's workspace location, if you provide a path in the job (be it via Parameter or Env. variable etc), it will be relative to that location. However, you can specify an absolute path for anywhere on the Jenkins Server, which will also work.

If you wish to read data from another server, you will need to make it available to the job's runtime/access level.

One example would be to put this file on IIS or Network Share or other form of sharing, and download it during your chef job into the workspace.

Powershell example for downloading a file from IIS site:

    $source = "http://my-web-server-ip/download/mycsvfile.csv"
    $destination = "c:\my-jenkins-job-workspace\mycsvfile.csv"
    Invoke-WebRequest $source -OutFile $destination

Please consider the above is just a basic implementation of this, and this can be accomplish in a number of ways - which some may be better than others.

Upvotes: 2

Related Questions