-
-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure fallback to system maven works #726
Conversation
c6510eb
to
015e372
Compare
@Hritik14, how do we test this? Is there something we could add to repotests? |
Sure.
|
1. In case the maven wrapper is found but is not ready or functioning, make sure the fallback to initially assumed "mvn" command works. 2. spawnSync returns an ``error`` object only in case child process is timed out or the invocation itself fails. Read ``status`` as well to ensure that the child process executed successfully Signed-off-by: Hritik Vijay <[email protected]>
; ../cdxgen/bin/cdxgen.js -p Executing '/Users/neo/contrib/appthreat/broken-mvn-wrapper/gs-spring-boot-main/complete/mvnw org.cyclonedx:cyclonedx-maven-plugin:2.7.10:makeAggregateBom -DoutputName=bom -DincludeTestScope=true -q' in /Users/neo/contrib/appthreat/broken-mvn-wrapper/gs-spring-boot-main/complete Fallback to executing /Users/neo/contrib/appthreat/broken-mvn-wrapper/gs-spring-boot-main/complete/mvnw dependency:tree -DoutputFile=/var/folders/l1/tbpy9vkn2151gnkf324c1bdm0000gr/T/cdxmvn-6HUFz0/mvn-tree.txt /Users/neo/contrib/appthreat/broken-mvn-wrapper/gs-spring-boot-main/complete/mvnw: line 1: unexpected EOF while looking for matching `'' /Users/neo/contrib/appthreat/broken-mvn-wrapper/gs-spring-boot-main/complete/mvnw: line 2: syntax error: unexpected end of file Resolve the above maven error. This could be due to the following: 1. Java version requirement: cdxgen container image bundles Java 20 with maven 3.9 which might be incompatible. 2. Private dependencies cannot be downloaded: Check if any additional arguments must be passed to maven and set them via MVN_ARGS environment variable. 3. Check if all required environment variables including any maven profile arguments are passed correctly to this tool. Falling back to manual pom.xml parsing. The result would be incomplete! ╔═══════════════════════════╤═════════════════════════════════════╤═══════════════════════════╤═════════════════╗ ║ Group │ Name │ Version │ Scope ║ ╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝ BOM includes 0 components and 0 dependencies ; (cd ../cdxgen; gh pr checkout 726) Previous HEAD position was 23a4902 Bump version Switched to branch 'master' Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) Already up to date. ../cdxgen/bin/cdxgen.js -p Executing 'mvn org.cyclonedx:cyclonedx-maven-plugin:2.7.10:makeAggregateBom -DoutputName=bom -DincludeTestScope=true -q' in /Users/neo/contrib/appthreat/broken-mvn-wrapper/gs-spring-boot-main/complete pkg:maven/com.example/[email protected]?type=jar ├── pkg:maven/org.springframework.boot/[email protected]?type=jar │ ├── pkg:maven/io.micrometer/[email protected]?type=jar │ │ ├── pkg:maven/io.micrometer/[email protected]?type=jar │ │ ├── pkg:maven/io.micrometer/[email protected]?type=jar └───└───└───└── pkg:maven/io.micrometer/[email protected]?type=jar │ │ ├── pkg:maven/org.hdrhistogram/[email protected]?type=jar └───└───└── pkg:maven/org.latencyutils/[email protected]?type=jar │ ├── pkg:maven/io.micrometer/[email protected]?type=jar Signed-off-by: Hritik Vijay <[email protected]>
@@ -277,6 +281,7 @@ jobs: | |||
run: | | |||
bin/cdxgen.js -p -t python repotests/blint -o bomresults/bom-blint.json | |||
bin/cdxgen.js -p -t python repotests/blint -o bomresults/bom-blint-deep.json --deep | |||
bin/cdxgen.js -p -t java repotests/broken-mvn-wrapper -o bomresults/bom-broken-mvn-wrapper.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Thank you!
@@ -6999,6 +6999,7 @@ export const getMavenCommand = (srcPath, rootPath) => { | |||
let isWrapperReady = false; | |||
let isWrapperFound = false; | |||
let findMavenFile = "mvnw"; | |||
let mavenWrapperCmd = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally undefined is used instead of null.
I am trying to fix the repotests. Once it's done you can rebase from master |
error
object only in case child process is timed out or the invocation itself fails. Readstatus
as well to ensure that the child process executed successfully