You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the datasets #87
Steps to reproduce the behavior:
execute below command with latest code analyser (1.0.8)
java -jar codeanalyzer-1.0.8.jar -i ~/{root project folder} -o ~/{outputFolder} -a 2
Observed behavior
Command execution is failing with the following error:
java.lang.RuntimeException: java.lang.IllegalStateException: Could not find a valid maven command. I did not find
/cash-account/mvnw in the project directory or in the system PATH.
at com.ibm.cldk.CodeAnalyzer.run(CodeAnalyzer.java:103)
at picocli.CommandLine.executeUserObject(CommandLine.java:1767)
at picocli.CommandLine.access$900(CommandLine.java:145)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2139)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2106)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1973)
at picocli.CommandLine.execute(CommandLine.java:1902)
at com.ibm.cldk.CodeAnalyzer.main(CodeAnalyzer.java:92)
Caused by: java.lang.IllegalStateException: Could not find a valid maven command. I did not find /cash-account/mvnw in the project directory or in the system PATH.
at com.ibm.cldk.utils.BuildProject.downloadLibraryDependencies(BuildProject.java:231)
at com.ibm.cldk.CodeAnalyzer.analyze(CodeAnalyzer.java:121)
at com.ibm.cldk.CodeAnalyzer.run(CodeAnalyzer.java:101)
Expected behavior
It should execute and build analysis.json without any error
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
changed the title [-]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the cash account dataset[/-][+]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the dataset[/+]on Jan 8, 2025
changed the title [-]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the dataset[/-][+]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the datasets[/+]on Jan 8, 2025
CodeAnalyzer requires a working Maven or Gradle build environment. I followed your instructions and reproduced the error.
Caused by: java.lang.IllegalStateException: Could not find a valid maven command. I did not find /cash-account/mvnw in the project directory or in the system PATH.
Then I noticed that the cash-account repo has a mvnw command so I tried to execute it but the execute bit was not set. So I set it and executed it to see if it works and got back this error:
$ ./mvnw
./mvnw: 223: cannot open /workspaces/java-test-env/code/cash-account/.mvn/wrapper/maven-wrapper.properties: No such file
/workspaces/java-test-env/code/cash-account/.mvn/wrapper/maven-wrapper.jar: No such file or directory
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
Clearly not working. Then I renamed it to get it out of the way:
$ mv ./cash-account/mvnw ./cash-account/_mvnw
Then I executed CodeAnalyzer again:
$ java -jar codeanalyzer-1.0.8.jar -i ./cash-account -o ./output/cash-account -a 2
and it worked this time producing an ./output/cash-account/analysis.json file as expected.
We will still accept this as a bug because if mvnw fails we should fall back to using the raw mvn command, but at least you have a work-around while we fix this. (i.e., name mvnw, run codeanalyzer, rename it back) Renaming mvnw in theportfolio-spring project works as well. We will investigate further.
Thanks for the workaround. We have adopted this as temporary code as a fallback mechanism in our pipeline, and it is working perfectly. We will be monitoring the latest code analyzer releases.
Activity
[-]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the cash account dataset[/-][+]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the dataset[/+][-]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the dataset[/-][+]The latest version (codeanalyzer-1.0.8.jar) of the code analyzer is failing when executing the datasets[/+]rofrano commentedon Jan 9, 2025
CodeAnalyzer requires a working Maven or Gradle build environment. I followed your instructions and reproduced the error.
Then I noticed that the
cash-accountrepo has amvnwcommand so I tried to execute it but the execute bit was not set. So I set it and executed it to see if it works and got back this error:Clearly not working. Then I renamed it to get it out of the way:
Then I executed CodeAnalyzer again:
and it worked this time producing an
./output/cash-account/analysis.jsonfile as expected.We will still accept this as a bug because if
mvnwfails we should fall back to using the rawmvncommand, but at least you have a work-around while we fix this. (i.e., namemvnw, run codeanalyzer, rename it back) Renamingmvnwin theportfolio-springproject works as well. We will investigate further.rejoykulangara commentedon Jan 17, 2025
Thanks for the workaround. We have adopted this as temporary code as a fallback mechanism in our pipeline, and it is working perfectly. We will be monitoring the latest code analyzer releases.