Jenkins build failure when run as a windows service - java

Unable to successfully build a jenkins job when the jenkins is run as a windows service. these are steps I followed-
1) ran java -jar jenkins.war from cmd
2) navigated to 'install as a windows service' under manage jenkins and created jenkins service under services.msc.
3) closed the cmd (through which the jenkins war file was initially run)
4) created a maven project and tried code from local pom location as well as from the bit bucket.
5) executed via clean install goals and options
result- build unstable. browser did not launch and tests failed.
any help much appreciated.
Results when build with code supplied from local pom file
Results :
Tests in error:
Then Login is successful(Scenario: Verify that login is successful with valid username and password): Expected condition failed: waiting for text ('DASHBOARD') to be present in element found by By.id: menutitle (tried for 10 second(s) with 3 SECONDS interval)(..)
Scenario: Verify that login is successful with valid username and password: Expected condition failed: waiting for text ('DASHBOARD') to be present in element found by By.id: menutitle (tried for 10 second(s) with 3 SECONDS interval)(..)
Tests run: 4, Failures: 0, Errors: 2, Skipped: 0
[ERROR] There are test failures.
Please refer to C:\Users\rajeshg\IdeaProjects\Test_analysis\target\surefire-reports for the individual test results.
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # NxTier ---
[INFO] Building jar: C:\Users\rajeshg\IdeaProjects\Test_analysis\target\NxTier-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # NxTier ---
[INFO] Installing C:\Users\rajeshg\IdeaProjects\Test_analysis\target\NxTier-1.0-SNAPSHOT.jar to C:\WINDOWS\system32\config\systemprofile\.m2\repository\aBILLity\NxTier\1.0-SNAPSHOT\NxTier-1.0-SNAPSHOT.jar
[INFO] Installing C:\Users\rajeshg\IdeaProjects\Test_analysis\pom.xml to C:\WINDOWS\system32\config\systemprofile\.m2\repository\aBILLity\NxTier\1.0-SNAPSHOT\NxTier-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.212 s
[INFO] Finished at: 2016-12-16T13:58:55+00:00
[INFO] Final Memory: 27M/311M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving C:\Users\rajeshg\IdeaProjects\Test_analysis\pom.xml to aBILLity/NxTier/1.0-SNAPSHOT/NxTier-1.0-SNAPSHOT.pom
[JENKINS] Archiving C:\Users\rajeshg\IdeaProjects\Test_analysis\target\NxTier-1.0-SNAPSHOT.jar to aBILLity/NxTier/1.0-SNAPSHOT/NxTier-1.0-SNAPSHOT.jar
channel stopped
Finished: UNSTABL

Related

Problem with Maven plugin :maven-enforcer-plugin:3.0.0-M3:enforce Some Enforcer rules have failed

A little bit of context:
Im working as a FE developer for an AEM project. The project is a SPA AEM as cloud service. I am running the author instance from the command line.
My pc specs are:
CPU: Intel(R) Core(TM) i5-7400 CPU # 3.00GHz 3.00 GHz
RAM: 24.0 GB
SSD: 476 GB
OS: Windows 10 Pro
For the AEM Project we are using
Java sdk 11
Maven 3.6.3
I have already set up everything, the path variables, JAVA_HOME, mvn. All of them work fine, even trying to build other type of projects with "older" versions of AEM like 6.5 build perfectly. I don't have a problem with them. But with this version of AEM I am getting this error
[WARNING] Rule 9: org.apache.maven.plugins.enforcer.RequireFileChecksum failed with message:
There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/renders/default_renders.any
[WARNING] Rule 10: org.apache.maven.plugins.enforcer.RequireFileChecksum failed with message:
There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/virtualhosts/default_virtualhosts.any
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for xxxxxx 1.0.0-SNAPSHOT:
[INFO]
[INFO] xxxxxx ................................. SUCCESS [ 0.270 s]
[INFO] xxxxxx - Core .......................... SUCCESS [ 59.232 s]
[INFO] xxxxxx - UI Frontend ................... SUCCESS [ 19.876 s]
[INFO] xxxxxx - UI Frontend React ............. SUCCESS [ 39.613 s]
[INFO] xxxxxx - Repository Structure Package .. SUCCESS [ 0.991 s]
[INFO] xxxxxx - UI apps ....................... SUCCESS [ 12.990 s]
[INFO] xxxxxx - UI content .................... SUCCESS [ 4.178 s]
[INFO] xxxxxx - UI config ..................... SUCCESS [ 0.314 s]
[INFO] xxxxxx - All ........................... SUCCESS [ 1.052 s]
[INFO] xxxxxx - Integration Tests ............. SUCCESS [ 12.166 s]
[INFO] xxxxxx - Dispatcher .................... FAILURE [ 0.030 s]
[INFO] xxxxxx - UI Tests ...................... SKIPPED
[INFO] xxxxxx - Project Analyser .............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:34 min
[INFO] Finished at: 2021-08-22T15:11:20-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-checksum-of-immutable-files) on project xxxxxxx.dispatcher.cloud: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :xxxxxx.dispatcher.cloud
I've been searching in sites, some of the answers for this problem haven't work for me.
I tried to run everything from the "gitbash"
command line and I had the same problem.
I tried to change the version in the pom.xml, didnt work.
I tried to build the project using eclipse IDE and all the build-in tools, I get an error that org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce is missing
Disable firewall and antivirus, nope
Use other versions of maven like 3.8.2
Delete the .m2 directory and download again all the plugins, not working
One of many answers tell me to comment out the dispatcher module in the pom.xml and after I did that builds fine. Other is doing the same and upload the ui.apps/target/*.zip with the crx package manager I did it but im not sure if the result is the "best".
To end, I installed the same project in a Mac Pro and i did without a problem. I hope someone can help me with this. Thanks for reading.
[WARNING] Rule 9: org.apache.maven.plugins.enforcer.RequireFileChecksum failed with message:
There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/renders/default_renders.any
The Maven Enforcer Plugin is checking for some files to have an specific checksum using requireFileChecksum rule
Somewhere in your pom.xml the Enforcer Maven plugin should be declared, so you will be able to see the rule and the hash it is applying. This xml snippet is from the maven plugin documentation.
<requireTextFileChecksum>
<file>E:\java-workspace\apache-maven-enforcer\maven-enforcer\target\checkout\enforcer-rules\target\classes/foo.txt</file>
<checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
<type>md5</type>
</requireTextFileChecksum>
Check that hash against the hash of the file of your filesystem. Maybe when you change aem version, you need to upgrade some of those files.
As discussed here: https://github.com/adobe/aem-guides-wknd/pull/202
Adobe have reported the issue and the fix to Adobe AEM WKND project:
Some Windows users experience a Maven enforcer issue where it appears that default dispatcher files have been modified. Unclear if this is a result of differences between Mac and Windows or something that occurs during the checkout process. Most users simply want to install the code base to a local environment and this check is unnecessary. Removing the enforcement for windows builds.
so you can :
Skips Dispatcher enforcement plugin for users on windows environments.
doing a change you dispatcher/pom.xml
with the commit reported here:
https://github.com/adobe/aem-guides-wknd/pull/202/commits/bebcf5d2236c75a95055d5ff71ea58f66379f271
replacing the line:
<goal>enforce</goal>
with:
<goal>display-info</goal>

Problem when running insert-sample <login> <pwd>

I'm exploring DocdokuPLM.
To Install docdoku I have used the docker configuration file which can be found here.
Using it have configured and installed Docdokuplm in my localhost.
Now not sure why sample project is not getting imported.
To import and check sample project I have used the following command.
sudo ./platform-ctl insert-sample MY_LOGIN_USER_ID MY_PASSWORD
While running the command to import sample project i'm getting the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.571 s
[INFO] Finished at: 2019-01-31T07:29:36+00:00 [INFO] Final Memory: 34M/301M
[INFO] ------------------------------------------------------------------------
[INFO] - No workspace name supplied, generating one...
[INFO] - Using wks-a72fca63 as workspace name
[INFO] - Starting load process...
[INFO] - Checking server availability...
[INFO] - Creating your account...
[INFO] - Creating account [sommesh29]
[INFO] - Cannot create account, trying to use given credentials for next operations
[INFO] - Creating workspace...
[INFO] - Adding user sommesh29 to workspace wks-a72fca63
[SEVERE] - Ooops, something went wrong while loading sample data : Not Found Not Foundcom.docdoku.api.client.ApiException: Not Found
at com.docdoku.api.client.ApiClient.handleResponse(ApiClient.java:838)
at com.docdoku.api.client.ApiClient.execute(ApiClient.java:773)
at com.docdoku.api.client.ApiClient.execute(ApiClient.java:757)
at com.docdoku.api.services.WorkspacesApi.addUserWithHttpInfo(WorkspacesApi.java:833)
at com.docdoku.api.services.WorkspacesApi.addUser(WorkspacesApi.java:819)
at com.docdoku.loaders.SampleLoader.addUserToWorkspace(SampleLoader.java:304)
at com.docdoku.loaders.SampleLoader.load(SampleLoader.java:88)
at com.docdoku.loaders.Main.main(Main.java:73)
what am i doing wrong ?
Is this a issue from my side or is this issue occurring from Docker file?

Error while scanning a project with Sonar Scanner

I have been trying to scan a java project (ArgoUML) with the sonar scanner and I'm getting the following error when using sonar-scanner in the project directory:
ERROR: Error during SonarQube Scanner execution
ERROR: Please provide compiled classes of your project with sonar.java.binaries property
The project is cloned from this repo:
https://github.com/cscorley/argouml-mirror
I tried building with maven using mvn package and mvn install but every time I'm getting an error. The last error that I got is:
Results :
Failed tests:
Tests in error:
Tests run: 1106, Failures: 2, Errors: 8, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] argouml-core 0.35.2-SNAPSHOT ....................... SUCCESS [ 0.898 s]
[INFO] argouml-core-model ................................. SUCCESS [ 0.783 s]
[INFO] argouml-core-model-mdr ............................. SUCCESS [ 8.167 s]
[INFO] argouml-core-model-euml ............................ SUCCESS [ 0.162 s]
[INFO] argouml-app ........................................ FAILURE [04:55 min]
[INFO] argouml-core-notation .............................. SKIPPED
[INFO] argouml-core-transformer ........................... SKIPPED
[INFO] argouml-core-umlpropertypanels ..................... SKIPPED
[INFO] argouml-core-diagrams-activity2 .................... SKIPPED
[INFO] argouml-core-diagrams-class2 ....................... SKIPPED
[INFO] argouml-core-diagrams-sequence2 .................... SKIPPED
[INFO] argouml-core-diagrams-state2 ....................... SKIPPED
[INFO] argouml-core-diagrams-structure2 0.35.2-SNAPSHOT ... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:05 min
[INFO] Finished at: 2018-05-03T12:07:31+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8.1:test (default-test) on project argouml: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/redhood148/Documents/git/argouml-mirror/src/argouml-app/target/surefire-reports for the individual test results.
Any suggestions how I can fix this?
Let me know if you need more info.
Thanks.
I do not exactly know the reason for this, but can help you with the solution that worked for me.
You must have mentioned the source path under "sonar.sources" in your configuration specifying the source package from where code needs to be scanned.
eg. sonar.sources=/home/workspace/codecoveragejob/Test_project/Test_project_service/src
along with this property, set another property under "sonar.java.binaries" and provide same value as "sonar.sources".
So it would look something like this:
sonar.sources=/home/workspace/codecoveragejob/Test_project/Test_project_service/src
sonar.java.binaries= /home/workspace/codecoveragejob/Test_project/Test_project_service/src
Hope that helps...
You have unit tests in argouml-app that are failing. You can either fix the code or the tests so that they pass. Or you can just skip the tests by running mvn install -DskipTests when building the project. This will allow you to build the project and produce the binaries that Sonar needs.

Why my maven package triggered by Jenkins failed but can be success if I manually execute it?

I have a jenkins job which tend to build my java application using maven, but it always gets failure during the compile phase.
[[1;34mINFO[m] Changes detected - recompiling the module!
[[1;34mINFO[m] Compiling 550 source files to /var/lib/jenkins/workspace/test/target/classes
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1;31mBUILD FAILURE[m
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] Total time: 9.575 s
[[1;34mINFO[m] Finished at: 2017-12-02T07:47:47+08:00
[[1;34mINFO[m] Final Memory: 24M/346M
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;33mWARNING[m] The requested profile "nexus" could not be activated because it does not exist.
[[1;31mERROR[m] Failed to execute goal [32morg.apache.maven.plugins:maven-compiler-plugin:3.1:compile[m [1m(default-compile)[m on project [36mtest[m: [1;31mCompilation failure[m -> [1m[Help 1][m
[[1;31mERROR[m]
I find and copied the below command in the Jenkins job's console output(on the webpage).
/opt/apache-maven-3.5.0/bin/mvn -f pom.xml -s /var/lib/jenkins/test-maven-setting/setting.xml -gs /var/lib/jenkins/test-maven-setting/setting.xml -Dmaven.repo.local=/var/lib/jenkins/workspace/test/.repository clean package
Then I switched to the jenkins user in the Linux console and go to the job's workspace directory and tried to manually execute the above commands I copied.
but it success!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.994 s
[INFO] Finished at: 2017-12-02T07:50:17+08:00
[INFO] Final Memory: 35M/298M
so it's very strange, same commands, same user, same directory, but it can success when I execute it manually while fail when Jenkins build the job. Does anyone know what's the problem that Jenkins job failed?
here I retested the maven plugin and pasted some screenshots.
You as using "use default maven settings" option in invoke-maven-targets.
select option for "settings file in filesystem" for both default and global

Maven deployment timeout / failure to generate checksums

I'm trying to deploy an artifact to clojars which provides a public Maven repository.
When I run the deployment I get a failure at the end with the following output, apparently after a 60 secs timeout:
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # clisk ---
Uploading: https://clojars.org/repo/net/mikera/clisk/0.3.0/clisk-0.3.0.jar
Uploading: https://clojars.org/repo/net/mikera/clisk/0.3.0/clisk-0.3.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:13.466s
[INFO] Finished at: Tue Aug 07 08:51:00 SGT 2012
[INFO] Final Memory: 21M/253M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project clisk: Failed to deploy artifacts: Could not transfer artifact net.mikera:clisk:jar:0.3.0 from/to clojars (https://clojars.org/repo): No response received after 60000 -> [Help 1]
Interestingly, the following happens:
The jar and the pom are successfully deployed (I can see them in the repo)
The various MD5 / SHA1 checksums are not generated
Further links:
The reported issue
The pom.xml
I'm using the built-in Maven support within Eclipse Juno
What am I doing wrong?
This isn't a complete solution but a workaround I found, posted here in case anyone else needs it.
Build the code and install in the local repository with "Run As.../Maven Install"
Make sure pageant is running with your SSH key (from the PuTTY suite). The SSH key must match the public key you provide to Clojars in your profile
Open a console and cd into the ".m2" local repository directory to find you .pom and .jar files
Run the following command:
pscp -scp *.pom *.jar clojars#clojars.org:
This seems to work successfully: Clojars itself will generate the required checksum files.

Categories