sbt-launch.jar failed - Could not load main class - jenkins

I have a jenkins build to check sbt, which is failing with the below error:
[sbt-check] $ /var/hudson/tools/java1.8.0_51/bin/java /var/hudson/tools/sbt-0.13.12/bin/sbt-launch.jar -Dsbt.log.noformat=true -jar clean assembly
Error: Could not find or load main class .var.hudson.tools.sbt-0.13.12.bin.sbt-launch.jar
Build step 'Build using sbt' changed build result to FAILURE
Build step 'Build using sbt' marked build as failure
Successfully triggered JIRA to update builds of this job
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 9 second
Notifying upstream projects of job completion
Finished: FAILURE
The sbt package is installed on the server. I downloaded package SBT-0.13.12.TGZ from http://www.scala-sbt.org/download.html and created its RPM to install it on my server. Package is installed and I have configured the path of sbt-launch in manage-jenkins.

Related

Jenkinsfile clear gradle cache and retry on failure

Current scenario: We have configured CI pipeline and running a jenkinsfile.groovy script for a gradle build. The pipeline is working fine and now we are planning to enable an error handling functionality into the groovy script.
Reason of this functionality: Sometimes, the gradle build is unable to download all the dependencies due to the network glitch or could be any reason. So, as a part of this functionality, we wants to add the following steps in the existing pipeline:
throw an error message of the failure
clear the cache from the gradle home directory
rebuild failed jenkins job
stop the existing failed build
Following code is included in the pipeline to enable the functionality:
catch (err) {
echo "Build failed for ${env.JOB_NAME}, clearing cache from the $GRADLE_HOME and retrying"
sh "rm -rf $GRADLE_HOME"
build "${env.JOB_NAME}"
throw err
}
Testing of new functionality: We are now in testing phase of the above code which is working fine, and three steps of the functionality is achieved, however, throw err (last step) doesn't stop the existing failed build after triggering same build again and keeps waiting for the build to complete.
Success of the new functionality in the existing pipeline:
throw an error message of the failure : ACHIEVED
clear the cache from the gradle home directory : ACHIEVED
rebuild failed jenkins job : ACHIEVED
stop the existing failed build : NOT ACHIEVED this fourth and the last step is not working as expected and doesn't stop the failed build. The failed build keeps waiting for the next job to complete. We have tried adding exit 1 as well but no luck.
Any help would be really appreciable. TIA

Automated Deployement Build Failed in Jenkins

I am doing automated deployemnt in jenkins and getting error saying that:
Build step 'Execute Windows batch command' marked build as failure.
Building on master in workspace:
C:\Program Files (x86)\Jenkins\workspace\AutomatedDeployement1
[AutomatedDeployement1] $ cmd /c call C:\Windows\TEMP\jenkins1993620515430909066.bat
C:\Program Files (x86)\Jenkins\workspace\AutomatedDeployement1>date
The current date is: 08-06-2020
Enter the new date: (dd-mm-yy)
C:\Program Files (x86)\Jenkins\workspace\AutomatedDeployement1>exit 1
Build step 'Execute Windows batch command' marked build as failure
[DeployPublisher][INFO] Build failed, project not deployed
Finished: FAILURE
Your answer will help me in learning. Thanks In advance
The "marked build as failure" message happens because of the exit code in your batch file. Try exit 0 instead of exit 1.
You can also instruct Jenkins to continue building even though there was a build error.

Jenkins "build error" for the same build command which builds "success build" simultaneously

I am using Jenkins for CI/CD on the AWS server. I have configured the job which includes Github private repo.
"Build Trigger->Poll SCM-> * * * * *" configuration is using for Build Triggering.
"Build Environment->Delete workspace before build starts" for the Build environment
"Build-> Execute Shell" (the script is below)
pm2 stop <*pm2 id*>
npm install
npm run build
pm2 serve build <*server port*>
The thing is this configuration built successfully and I could see the output as expected.
And the problem is the same configuration build failed for very next of success build.
If I wait a few minutes and build the job again it "build success"
So my query is, should I have to wait a certain time duration after a successful build or something else?

Dimensions plugin for Jenkins load any build artifacts to dimensions set request id

In my Jenkins build job I pull java code from Gitlab and build on Jenkins using Ant build script (build.xml). A .zip file outcome of the build.
I am trying to upload build artifacts (zip file) to Dimensions CM using Dimensions plugin for Jenkins using 'load any build artifacts to dimensions' as a post build action. Dimension is rejecting the artifact due to lack of the request id for it attach this artifact in Dimensions.
The plugin documentation says to "If you wish to specify a request to save these changes against, then you should set a project default request using SCWS or use DM_TARGET_REQUEST"
I am getting this error:
START ======= Started by user Ahmad, Ershad [EnvInject] -
Loading node environment variables. Building on master in
workspace /opt/wss/stg/jenkins/DimensionsUpload1 [DIMENSIONS]
Calculating changes for directory
'DM_TARGET_REQUEST=PCMTPROJPROJ_SMR_82'... [DimensionsUpload1] $
/bin/sh -xe
/opt/wss/stg/apache-tomcat-6.0.43/temp/hudson7507543782532160733.sh
+ cd /opt/wss/stg/jenkins/DimensionsUpload1
+ ls -ltr total 138484
-rw-r-----. 1 webdev webdev 141800254 Feb 16 08:11 BuildArtifact.1.0.zip [DIMENSIONS] Running checkin on
master... [DIMENSIONS] Running build in
'/opt/wss/stg/jenkins/DimensionsUpload1'... [DIMENSIONS] Scanning
workspace for files to be saved into Dimensions... [DIMENSIONS]
Running Ant pattern scanner... [DIMENSIONS] Found 1 file(s) to
check in... [DIMENSIONS] Loading files into Dimensions project
"PCMTPROJ:RELSTREAM"... FATAL: Unable to run checkin callout
(DimensionsRuntimeException: Upload files (DimensionsRuntimeException:
Dimensions command 'UPLOAD
/USER_FILELIST="/opt/wss/stg/apache-tomcat-6.0.43/temp/dmCm15188000765706781907912904279764.tmp"
/WORKSET="PCMTPROJ:RELSTREAM" /COMMENT="Build artifacts delivered by
Jenkins for job 'DEVOPS_PCMTPROJ_DmUpload' - build 68"
/USER_DIRECTORY="/opt/wss/stg/jenkins/DimensionsUpload1"' failed
(DimensionsRuntimeException: Using Project 'PCMTPROJ:RELSTREAM'. Using
'/opt/wss/stg/jenkins/DimensionsUpload1/' as the Project work
area. Scanning repository: 0.00 sec Scanning local work
area: 0.00 sec Creating new item revision for
'/opt/wss/stg/jenkins/DimensionsUpload1/BuildArtifact.1.0.zip'
COR0005162E Error: To create a new Item revision of type PROD_CODE you must specify a valid request COR0006384E Error: Failed to
create Item for
'/opt/wss/stg/jenkins/DimensionsUpload1/BuildArtifact.1.0.zip'
Warning: There were errors while uploading files from the specified
network node. Please check the upload log. Updating files: 2.57
sec Uploading Project: 2.58 sec ))) Build step 'Load
any build artifacts into the Dimensions repository' changed build
result to FAILURE Build step 'Load any build artifacts into the
Dimensions repository' marked build as failure Finished:
FAILURE
=======END
I have tried using the export command in shell but it doesn't work:
cd /opt/wss/stg/jenkins/DimensionsUpload1
ls -ltr
export $ITEM_TYPE PROD_CODE
export $DM_TARGET_REQUEST PCM_SMR_82
I was able to resolve this using the below option
Click on configure in your build job
[Check box] This build is parameterized (see pic below)

Error in Executing Jobs on Slave In Jenkins

I have Master Slave configuration under Jenkins.I wanted to run a job on the slave system under Jenkins I order to do that I have copied the required scripts and files But I have been getting the following error
Started by user anonymous
[EnvInject] - Loading node environment variables.
Building remotely on MySlave in workspace C:\Users\prathamesh.n\workspace\MasterSlave
FATAL: Cannot find executable from the chosen Ant installation "apache-ant-1.9.4"
Build step 'Invoke Ant' marked build as failure
Archiving artifacts
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level C:\Users\sudharshan.r\workspace\Ant\exec\reports\Test 1 to C:\Users\sudharshan.r.jenkins\jobs\Project 11\htmlreports\HTML_Report
ERROR: Specified HTML directory 'C:\Users\sudharshan.r\workspace\Ant\exec\reports\Test 1' does not exist.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: C:/Users/sudharshan.r/workspace/Ant/exec/reports/Test 1/testng-results.xml
Did not find any matching files.
[BFA] Scanning build for known causes...
[BFA] Done. 0s
Finished: FAILURE
need help on executing ant on slave
Click on Jenkins - > Manage Jenkins -> configure system -> Under Ant, define your installer and then in your job select that ant configuration.
Whats your configuration in your build? Default or let's assume my 1.9.
Now in "configure jenkins": Add a specific ant e.g. with name my 1.9.
easiest way is automatic installation and installation from Apache
if you don't want to do this: uncheck automatic installation and give your path were you installed ant in the field: ANT_HOME

Resources