DigitalExperienceManager-CommunityDistribution-7.3.1.0 starts with error 'Cannot set maven executable to mvn, please check your configuration' - jahia

I've installed DigitalExperienceManager-CommunityDistribution-7.3.1.0-r59490.jar on my MAC, and run the commands to start it:
cd /Applications/DigitalExperienceManager-CommunityDistribution-7.3.1.0/
./start.sh
I find this error in catalina.out:
2020-12-16 19:14:55,509: INFO [ProcessHelper] - [mvn, -version]
2020-12-16 19:14:55,517: ERROR [ModuleBuildHelper] - Cannot set maven
executable to mvn, please check your configuration
org.jahia.exceptions.JahiaRuntimeException: java.io.IOException:
Cannot run program "mvn" (in directory "."): error=2, No such file or
directory at
org.jahia.utils.ProcessHelper.execute(ProcessHelper.java:203) at
org.jahia.utils.ProcessHelper.execute(ProcessHelper.java:138) at
org.jahia.services.templates.ModuleBuildHelper.checkMavenExecutable(ModuleBuildHelper.java:493)
at
org.jahia.services.templates.ModuleBuildHelper.afterPropertiesSet(ModuleBuildHelper.java:534)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at
org.apache.pluto.driver.PortalStartupListener.contextInitialized(PortalStartupListener.java:108)
at
org.jahia.bin.listeners.JahiaContextLoaderListener.contextInitialized(JahiaContextLoaderListener.java:235)
Caused by: java.io.IOException: Cannot run program "mvn" (in directory
"."): error=2, No such file or directory at
java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at
java.lang.Runtime.exec(Runtime.java:620) at
org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
at
org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.jahia.utils.ProcessHelper.execute(ProcessHelper.java:199) ...
80 more Caused by: java.io.IOException: error=2, No such file or
directory at java.lang.UNIXProcess.forkAndExec(Native Method) at
java.lang.UNIXProcess.(UNIXProcess.java:247) at
java.lang.ProcessImpl.start(ProcessImpl.java:134) at
java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 86 more
2020-12-16 19:14:55,523: ERROR [ModuleBuildHelper] - Until maven
executable is correctly set, the studio will not be available
But I'm sure maven is installed on my machine already:
$ mvn -version Apache Maven 3.6.3
(cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home:
/Users/george/apache-maven-3.6.3 Java version: 1.8.0_191, vendor:
Oracle Corporation, runtime:
/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8 OS name: "mac os x",
version: "10.15.5", arch: "x86_64", family: "mac"
What can I do to solve this problem?

Do you have maven in your path? Seems Jahia cannot find maven on startup. When it is not in path you can specify in jahia.properties (\digital-factory-config\jahia\jahia.properties) the full path to maven:
#mvnPath = mvn
Uncomment this property and specify the right path to maven like:
mvnPath = /usr/local/apache-maven/bin/mvn

Related

specified user toolchains file does not exist

I am trying to run a test on one of the pools present and while doing do I am getting the below error
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_282, vendor: Private Build
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1127.13.1.el7.x86_64", arch: "amd64", family: "unix"
/usr/bin/mvn -f /azp/_work/81/s/pom.xml -tags=#FmaTest clean test
[ERROR] Error executing Maven.
[ERROR] The specified user toolchains file does not exist: /azp/_work/81/s/ags=#Test
tried with a couple of options that I found online but all in vain
The specified user toolchains file does not exist:
Based on the error info, the cause of this issue is that the toolchains.xml hasn't been added to the $HOME/.m2 folder.
You can try to check the $Home in Pipeline with the following script:
steps:
- script: echo $HOME
Then you can use the Copy File task to copy the toolchains.xml to the target folder.
For example: the $Home : /home/vsts
- task: CopyFiles#2
displayName: 'Copy Files to: /home/vsts/.m2'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: toolchains.xml
TargetFolder: /home/vsts/.m2
In this case, I can run the maven task successfully.
Here is the doc about using the toolchains
This file should be put in your ${user.home}/.m2 directory.

Build error in jenkins ERROR: Maven Home /home/app/maven-2.2.1 doesn’t exist

I am trying run Jenkins and Building a project.
I have install Maven 2.2.1. I downloaded Maven 2.2.1 and extracted in a folder Maven 2.2.1.
set the home path in .bash_profile.
content of .bash_profile
M2_HOME=/home/qaserver3/app/maven-2.2.1
export M2_HOME
PATH=$M2_HOME/bin:$JAVA_HOME/bin:$PATH
when I run mvn --version on terminal, I get
Apache Maven 2.2.1 (r801777; 2009-08-07 00:46:01+0530)
Java version: 1.6.0_45
Java home: /home/qaserver3/app/jdk1.6.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-358.el6.x86_64" arch: "amd64" Family: "unix"
[root#qaserver3 qaserver3]#
when I run echo $M2_HOME I get the correct home path
/home/qaserver3/app/maven-2.2.1
The above home path I have set in Jenkins.
Manage Jenkins -> Configure System -> Maven -> Maven installations ->
MAVEN_HOME = /home/qaserver3/app/maven-2.2.1
beloo I get a warining saying :
`home/qaserver3/app/maven-2.2.1 is not a directory on the Jenkins
master (but perhaps it exists on some slaves)'
but when I build the project I get this error
Console Output
ERROR: Maven Home /home/qaserver3/app/maven-2.2.1 doesn’t exist
How do I solve this issue?
Try this:
Give R/w permissions to your Jenkins user
chmod 0755 /home/qaserver3/
chmod -R 0755 /home/qaserver3/app/maven-2.2.1
Make ensure Jenkins can access all the files
sudo -iu jenkins
Run:
/home/qaserver3/app/maven-2.2.1/bin/mvn -v
You are most likely to see this warning 'home/qaserver3/app/maven-2.2.1 is not a directory on the Jenkins master (but perhaps it exists on some slaves)' when the path in your system information tab is different than you have provided in the environmental variable.
Go to manage jenkins->system information->now check the path of maven in the table.
Copy that path and paste it into the MAVEN_HOME field.
The warning should be gone by now and save it
cheers!

hadoop-2.2.0 compalition failing on Mac OS X 64bit

[ERROR] Failed to execute goal org.codehaus.mojo:native-maven-plugin:1.0-alpha-7:javah (default) on project hadoop-common: Error running javah command: Error executing command line: Error setting up environmental variables: Cannot run program "env": error=20, Not a directory -> [Help 1]
I got the same error in windows 8. Here's what I did:
Ensure javah is copied to the path that's specified as JAVA_HOME.
Tools.jar should be copied to to the corresponding lib folder of JAVA_HOME. For ex: if JAVA_HOME is c:..\jre, tools.jar should be copied to c:..\jre\lib.
This resolved the above said error. Hope this helps.

Using custom Maven version in Jenkins on OpenShift

I'm trying to run maven-android-sdk-deployer on my OpenShift Jenkins. It needs at least Maven 3.1.1 to run, whereas OpenShift currently uses version 3.0.5 as default. Thus I tried to configure a custom Maven installation.
My Maven system configuration:
name: maven-3.1.1
install automatically: true
one installer with "Unzip archive" (I also tried "Install from Apache" with the same result.)
label: empty
download url: http://mirror.synyx.de/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip
subfolder in archive: apache-maven-3.1.1
It seems to install Maven, because there is another error message, if "subfolder in archive" doesn't match. The zip file is valid.
But I cannot use it in the job.
I created a freestyle job and added a Maven step with the configured Maven installation.
There is an error message, when running the job:
[maven-android-sdk-deployer] $ app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn install -P 4.1
FATAL: command execution failed
java.io.IOException: Cannot run program "app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn" (in directory "app-root/data/jenkins/workspace/maven-android-sdk-deployer"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
... 13 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
... 17 more
Workaround for command line
I checked the file system the maven-android-sdk-deployer workspace and app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn both exist on the myappbldr-gear.
When I run the command from commandline I get the same error, whereas appending ~/ to the maven path works as intended:
[maven-android-sdk-deployer] $ ~/app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn install -P 4.1
Looks like this is an administration problem. How can I fix this?

maven error while running sonar from hudson job

We were trying to implement Static Code Analyzers in our Hudson CI and was trying as mentioned here but, i came across about using SONAR for the same feature. We performed the following steps , but got error when the Hudson Job runs
Installed Sonar & running
Installed Sonar plugin in Hudson and configured hudson with sonar instance details
Configured Sonar details for the already defined job
The hudson job ran successfully until it deployed the WAR file to Tomcat6, but it failed when it started the sonar operations.
We received the following error in the Hudson job console
java.io.IOException: Cannot run program "mvn.bat" (in directory "D:\Users\abcd.hudson\jobs\QA Build Local\workspace\view"): CreateProcess error=2, The system cannot find the file specified
mvn.bat -f "D:\Users\abcd\.hudson\jobs\QA Build Local\workspace\view\msaccess\MyApp\Code\appone\pom.xml" -e -B sonar:sonar -Dsonar.host.url=http://localhost:9000/ -Dsonar.language=java
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn.bat" (in directory "D:\Users\abcd\.hudson\jobs\QA Build Local\workspace\view"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at hudson.Proc$LocalProc.(Proc.java:192)
at hudson.Proc$LocalProc.(Proc.java:164)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:639)
at hudson.Launcher$ProcStarter.start(Launcher.java:274)
at hudson.Launcher$ProcStarter.join(Launcher.java:281)
at hudson.tasks.Maven.perform(Maven.java:263)
at hudson.plugins.sonar.utils.SonarMaven.executeMaven(SonarMaven.java:138)
at hudson.plugins.sonar.SonarPublisher.executeSonar(SonarPublisher.java:300)
at hudson.plugins.sonar.SonarPublisher.perform(SonarPublisher.java:261)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:630)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:608)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:584)
at hudson.model.Build$RunnerImpl.post2(Build.java:159)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:553)
at hudson.model.Run.run(Run.java:1390)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 19 more
Sonar analysis completed: FAILURE
We manually ran the maven-sonar command from command prompt and the sonar analysis completed successfully and the results published in the sonar website.
Note: We observed that the M2_HOME environment variable is not set in the server. Would this be an error ?
Update on Fix:
We set maven_home\bin folder in windows PATH environment variable and then sonar was able to recognize mvn.bat and run.
Sonar is being run as a separate Maven program. The command line is being displayed at the top of the log:
mvn.bat -f "D:\Users\abcd.hudson\jobs\QA Build Local\workspace\view\msaccess\MyApp\Code\appone\pom.xml" -e -B sonar:sonar -Dsonar.host.url=http://localhost:9000/ -Dsonar.language=java
This is expected, you attached screen shots specified this Sonar configuration.
Your problem does not appear to be the job configuration, instead Jenkins is unable to find the "mvn.bat" command....
java.io.IOException: Cannot run program "mvn.bat" (in directory "D:\Users\abcd.hudson\jobs\QA Build Local\workspace\view"): CreateProcess error=2, The system cannot find the file specified
You need to investigate how you've configured Maven.
I had the same. In my case I had to change location of maven directory - when it was in "c:\Program Files (x86)\wamp\bin\apache-maven-3.2.1\" it couldn't run, but when I moved it to "c:\maven" (and changed system variable: "Path" including "C:\maven\bin" and created by me "MAVEN_HOME = c:\maven").
I had to reboot computer to work - check in windows console (logo windows -> run "cmd") by typing "mvn -version" and you should have line "Maven home: C:\maven"
Installation
Jenkins installed as war in Tomcat
Tomcat installed as a service in Windows
I've installed Maven and correctly configured environment variables in Windows
Problem
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn.bat" (in directory "C:\.jenkins\workspace\my_project"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.Launcher$ProcStarter.join(Launcher.java:388)
at hudson.tasks.Maven.perform(Maven.java:328)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1759)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:177)
at java.lang.ProcessImpl.start(ProcessImpl.java:28)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
Solution
I've restarted Tomcat service so it has loaded the last configured Maven's environment variables making them available to Jenkins.

Resources