Jhipster project runs fine on Mac, but fails to run on Linux - maven

I have a JHipster project that includes Spring Boot and React Native. I run it OK using ./mvnw as the guide specifies, however, when I put the entire project on Ubuntu, it fails to run and the log is as follows:
ERROR Failed to execute goal
com.github.eirslett:frontend-maven-plugin:1.8.0:npm (webpack build dev)
on project galley-1: Failed to run task: 'npm run webpack:build' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.8.0:npm (webpack build dev)
Some points to note are that: I use sudo, and I already changed the webpack space size to be as big as 9000, in package.json.

Just to answer my own question, I finally find a way to run this:
On mac, I package my project using 'mvn -Pprod package -DskipTests' (sorry there were some tests that didn't pass at that time, I didn't get time to fix those at that time), and then on Linux:
nohup sudo java -jar *.jar &
It will do the trick. But if anyone gets any better idea, please share.

Related

Cannot invoke "java.io.File.isFile()" because "this.inputFile" is null

I met a problem when trying to build Quickfixj Project on Windows 10.
I tried the command using Git:
$ mvn clean package -Dmaven.javadoc.skip=true -DskipTests -PskipBundlePlugin
and it returned error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.4.2:single (bin-assembly) on project quickfixj-distribution: Execution bin-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:3.4.2:single failed: Cannot invoke "java.io.File.isFile()" because "this.inputFile" is null -
I've never met such problem and I searched online but no relevant solutions were found.
Shall I reinstall maven or other solutions recommended? Thanks!
This seems to be a bug with the QuickFIX/J build process.
If you omit -PskipBundlePlugin the build will succeed.
I had the same problem for me with mac m1, on vscode;
I just changed the version in the pom.xml file to:
maven-assembly-plugin-version>3.1.0</maven-assembly-plugin-version
and it worked for me.
in addition to that I Installed some apache extension for vscode.

Jenkins maven projet build failed on fork during test

I'm building maven project on Jenkins (version 2.263.4, not the last but not so far).
It's a git project with pipeline configuration and webhook from bitbucket when push is done on the project.
So when a developper create a branch and another one a pull request, i have 2 build in parallel. Domain test running in about 45min.
And sometimes(not always), i have this error :
Command was /bin/sh -c cd /jenkins/workspace/a-hub_test-plantage-jenkins_PR-1/server/project-core/project-core-domain && /jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2+9/bin/java -Xmx1500M -jar /jenkins/workspace/a-hub_test-plantage-jenkins_PR-1/server/project-core/project-core-domain/target/surefire/surefirebooter15630998754365374145.jar /jenkins/workspace/a-hub_test-plantage-jenkins_PR-1/server/project-core/project-core-domain/target/surefire 2021-05-04T12-39-54_622-jvmRun1 surefire5846464826560071036tmp surefire_13691263758446667285tmp
Error occurred in starting fork, check output in log
14:46:13 [ERROR] Process Exit Code: 1
14:46:13 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669)
14:46:13 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
14:46:13 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
If i re run the buildin error, it work.
I'm using maven-surefire 2.22.2.
I try to configure it following many thread on stackoverfow, but nothgin work. I try with forkMode none or something else, it work but i loose coverage because jaccoco need fork to work. So i'm stuck.
What can i do to help me to debug this problem?
I don't understand why build failed when another one is building because for me Jenkins work on different working folder, no? so why the problem appear when i'have multiple build in parallel?
thanks for help
I find an hs_err_pid.log in jenkins near source code and i see out of memory! i see that my test was launch with -Xmx1500Mo and problem occured when i launched multiple branch/pr, so jenkins use all of the memory and failed all build during fork...i decrease -Xmx and all seems to work.

exec-maven-plugin cannot run "mvn" command on Windows machine

I have a Spring Boot 2 project which is a ReST API, and I am using Spring Rest.
I am using 2 plugins to generate an SDK other projects to import to call my API. The first plugin is com.github.kongchen:swagger-maven-plugin:3.17 to generate the swagger-codegen-spec file, and the second is org.openapitools:openapi-generator-maven-plugin:3.2.3 to then generate the actual SDK files as another mvn project.
Finally, I have automated component tests that use that SDK to run tests against the running API.
My goal, is to actually BUILD the SDK as part of the original project build. So when I run "mvn install" on my-api-project, I end up with the web-app jar AND the sdk jar when it is complete, without having to run "mvn install" on the SDK as a secondary step.
I've successfully accomplished this on Linux/Mac in 2 different ways. First was to use the antrun plugin. However, this did not work on my co-worker's Windows 10, 64 bit machine. He was getting many issues regarding invalid directories and shell not being installed, etc.
So I tried using the exec-maven-plugin instead, which seems to be a lot cleaner, and more OS agnostic. Again, this works great in Linux/Max, but in Windows, now we get this error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
(build swagger-codegen sources) on project my-api: Command execution
failed.: Cannot run program "C:\Program Files\Apache\maven\bin\mvn"
(in directory
"C:\Users\user1\Documents\GitHub\my-project\my-java-sdk"):
CreateProcess error=193, %1 is not a valid Win32 application -> [Help
1]
When he uses the cmd window he can run "mvn install" in that directory just fine.
Any ideas??
This error was fixed by upgrading the exec-maven-plugin version to the latest version. Spring Boot was supplying the version, which was 1.5.0, but the latest is 1.6.0.

Maven wrapper in jenkins

I'm trying to test build a maven based project in jenkins.
https://github.com/tonsV2/Lift-Log-Backend
However I get the following error.
[Lift Log Backend] $ /bin/sh -xe /tmp/hudson4180120395829748105.sh
+ ./mvnw clean
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any clues?
Seems like you have spaces in your Jenkins job name. Try to rename your job from "Lift Log Backend" to "Lift-Log-Backend"
I had the same issue, after renaming the Jenkins job, the error was gone.

how to set requirejs plugin in maven

I move my project from ubuntu to windows, and the requirejs plugin not work!
I just change the nodejs path
<nodeExecutable>C:/Program Files/nodejs/node</nodeExecutable>
And the maven return this
[ERROR] Failed to execute goal com.github.mcheely:requirejs-maven-plugin:2.0.0:o
ptimize (default) on project interactBack: r.js exited with an error. -> [Help 1
]
I have test my project by cmd , and it works fun!
node r.js -o app.build.js
What's the problem?
I get the answer!
As is said by the author
nodeExecutable
An optional path to a nodejs executable. This should not be needed if node is in
the system path as 'node' or 'nodejs';
So, just delete the tag.

Resources