whitesource / unified-agent-distribution

51 stars 48 forks source link

wss-unified-agent tries to resolve mvn dependencies in gradle-only project and fails #38

Open ckuehne opened 2 years ago

ckuehne commented 2 years ago

I have a gradle Project. But the wss-unified-agent apparently finds maven dependencies and tries to resolve them by running maven. But mvn is not installed on the machine.

[DEBUG] [2022-05-25 07:10:22,253 +0200] - GradleDependencyResolver - resolveDependencies - END - 3
[INFO] [2022-05-25 07:10:22,260 +0200] - Trying to resolve MAVEN dependencies
[DEBUG] [2022-05-25 07:10:22,260 +0200] - Command - executeProcess - timeout set to 60s
[DEBUG] [2022-05-25 07:10:22,261 +0200] - Command - executeProcess - start execute command 'mvn -v' in '.'
[WARN] [2022-05-25 07:10:22,261 +0200] - Command - executeProcess - Command 'mvn -v' run Failed, Exception: Cannot run program "mvn" (in directory "."): error=2, No such file or directory
[DEBUG] [2022-05-25 07:10:22,261 +0200] - MAVEN installation status: false
[DEBUG] [2022-05-25 07:10:22,262 +0200] - The command was run under [..]/product/.
[INFO] [2022-05-25 07:10:22,262 +0200] - topFolder = [..]/org.jacoco.agent-0.8.7.jar_3a83c50b4a016f281c4e9f3500d16b55/META-INF/maven/org.jacoco/org.jacoco.agent
[DEBUG] [2022-05-25 07:10:22,262 +0200] - topFolder = [..]/build/tmp/expandedArchives/org.jacoco.agent-0.8.7.jar_3a83c50b4a016f281c4e9f3500d16b55/META-INF/maven/org.jacoco/org.jacoco.agent
[DEBUG] [2022-05-25 07:10:22,262 +0200] - Command - executeProcess - timeout set to 900s
[DEBUG] [2022-05-25 07:10:22,262 +0200] - Command - executeProcess - start execute command 'mvn -v' in '[..]/build/tmp/expandedArchives/org.jacoco.agent-0.8.7.jar_3a83c50b4a016f281c4e9f3500d16b55/META-INF/maven/org.jacoco/org.jacoco.agent'
[WARN] [2022-05-25 07:10:22,263 +0200] - Command - executeProcess - Command 'mvn -v' run Failed, Exception: Cannot run program "mvn" (in directory "[..]/build/tmp/expandedArchives/org.jacoco.agent-0.8.7.jar_3a83c50b4a016f281c4e9f3500d16b55/META-INF/maven/org.jacoco/org.jacoco.agent"): error=2, No such file or directory
[DEBUG] [2022-05-25 07:10:22,263 +0200] - Failed to get maven version
[WARN] [2022-05-25 07:10:22,263 +0200] - Please install maven
...
[ERROR] [2022-05-25 07:10:22,269 +0200] - Process finished with exit code ERROR (-1)
avinoamw1 commented 2 years ago

Hi @ckuehne , You can disable Maven resolution by toggling 'maven.resolveDependencies' off in your configuration. I'm not sure how your Unified Agent is configured aside from this, so I can only recommend making sure that the Gradle resolution is enabled. See more here: https://whitesource.atlassian.net/wiki/spaces/WD/pages/1544880156/Unified+Agent+Configuration+Parameters#Gradle

I hope this helps.

ckuehne commented 2 years ago

Hi @avinoamw1 ,

thanks. Setting maven.resolveDependencies=false resolves the issue. However, I was hoping for something more subtle.