##[error]No agent found in pool Default which satisfies the following demand: maven. All demands: maven, java, Agent.Version -gtVersion 2.144.0

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this
    SonarQube version = 7.9.3

Trying to build a Azure pipeline to for yml project which require Maven builds, but our Agent is not detecting Maven.

I have downloaded Maven and added it to environment variable as well.

Did you restart the build agent process? The agent process only checks the capabilities at startup.

Also, check the detected capabilites for the agent in your Azure Dev Ops portal.

Hi Duncan,

Yes i did that, now my agent is discoverable but Maven is not able to connect to our sonarqube environment.

Here is my log

2021-06-17T07:37:45.1241480Z ##[section]Starting: Maven pom.xml
2021-06-17T07:37:45.1578039Z ==============================================================================
2021-06-17T07:37:45.1578319Z Task : Maven
2021-06-17T07:37:45.1578515Z Description : Build, test, and deploy with Apache Maven
2021-06-17T07:37:45.1578705Z Version : 3.186.0
2021-06-17T07:37:45.1578874Z Author : Microsoft Corporation
2021-06-17T07:37:45.1579124Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/maven
2021-06-17T07:37:45.1579423Z ==============================================================================
2021-06-17T07:37:45.8894222Z [command]C:\windows\system32\cmd.exe /D /S /C “D:\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin\mvn.cmd -version”
2021-06-17T07:37:46.1659512Z Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
2021-06-17T07:37:46.1664414Z Maven home: D:\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin…
2021-06-17T07:37:46.1672328Z Java version: 11.0.11, vendor: Azul Systems, Inc., runtime: C:\Program Files\Zulu\zulu-11
2021-06-17T07:37:46.1677042Z Default locale: en_US, platform encoding: Cp1252
2021-06-17T07:37:46.1683897Z OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”
2021-06-17T07:37:46.2269875Z [command]C:\windows\system32\cmd.exe /D /S /C “D:\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin\mvn.cmd -f D:\Agent\vsts-agent-win-x64-2.187.2_work\1\s\pom.xml package org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar”
2021-06-17T07:37:47.5097588Z [INFO] Scanning for projects…
2021-06-17T07:37:47.7625788Z [INFO]
2021-06-17T07:37:47.7627544Z [INFO] ----------------------< com.example:spring-demo >-----------------------
2021-06-17T07:37:47.7640938Z [INFO] Building spring-demo 0.0.1-SNAPSHOT
2021-06-17T07:37:47.7645156Z [INFO] --------------------------------[ jar ]---------------------------------
2021-06-17T07:37:48.3128548Z [INFO]
2021-06-17T07:37:48.3139979Z [INFO] — maven-resources-plugin:3.1.0:resources (default-resources) @ spring-demo —
2021-06-17T07:37:48.6385426Z [INFO] Using ‘UTF-8’ encoding to copy filtered resources.
2021-06-17T07:37:48.6427499Z [INFO] Copying 1 resource
2021-06-17T07:37:48.6534223Z [INFO] Copying 0 resource
2021-06-17T07:37:48.6545937Z [INFO]
2021-06-17T07:37:48.6553561Z [INFO] — maven-compiler-plugin:3.8.0:compile (default-compile) @ spring-demo —
2021-06-17T07:37:48.9118267Z [INFO] Nothing to compile - all classes are up to date
2021-06-17T07:37:48.9126673Z [INFO]
2021-06-17T07:37:48.9131300Z [INFO] — maven-resources-plugin:3.1.0:testResources (default-testResources) @ spring-demo —
2021-06-17T07:37:48.9167742Z [INFO] Using ‘UTF-8’ encoding to copy filtered resources.
2021-06-17T07:37:48.9173347Z [INFO] skip non existing resourceDirectory D:\Agent\vsts-agent-win-x64-2.187.2_work\1\s\src\test\resources
2021-06-17T07:37:48.9176062Z [INFO]
2021-06-17T07:37:48.9179927Z [INFO] — maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ spring-demo —
2021-06-17T07:37:48.9310301Z [INFO] Nothing to compile - all classes are up to date
2021-06-17T07:37:48.9312562Z [INFO]
2021-06-17T07:37:48.9316343Z [INFO] — maven-surefire-plugin:2.22.1:test (default-test) @ spring-demo —
2021-06-17T07:37:49.4694373Z [INFO]
2021-06-17T07:37:49.4695806Z [INFO] -------------------------------------------------------
2021-06-17T07:37:49.4696638Z [INFO] T E S T S
2021-06-17T07:37:49.4699749Z [INFO] -------------------------------------------------------
2021-06-17T07:37:50.0194319Z [INFO] Running com.example.springdemo.SpringDemoApplicationTests
2021-06-17T07:37:50.1755528Z 13:07:50.169 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.1796549Z 13:07:50.177 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
2021-06-17T07:37:50.1860837Z 13:07:50.184 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
2021-06-17T07:37:50.2010967Z 13:07:50.199 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.springdemo.SpringDemoApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
2021-06-17T07:37:50.2096859Z 13:07:50.208 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.springdemo.SpringDemoApplicationTests], using SpringBootContextLoader
2021-06-17T07:37:50.2144293Z 13:07:50.212 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.springdemo.SpringDemoApplicationTests]: class path resource [com/example/springdemo/SpringDemoApplicationTests-context.xml] does not exist
2021-06-17T07:37:50.2154992Z 13:07:50.213 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.springdemo.SpringDemoApplicationTests]: class path resource [com/example/springdemo/SpringDemoApplicationTestsContext.groovy] does not exist
2021-06-17T07:37:50.2165266Z 13:07:50.213 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.springdemo.SpringDemoApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
2021-06-17T07:37:50.2176409Z 13:07:50.214 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.example.springdemo.SpringDemoApplicationTests]: SpringDemoApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
2021-06-17T07:37:50.2650038Z 13:07:50.263 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an ‘annotation declaring class’ for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.3386132Z 13:07:50.336 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\Agent\vsts-agent-win-x64-2.187.2_work\1\s\target\classes\com\example\springdemo\SpringDemoApplication.class]
2021-06-17T07:37:50.3483738Z 13:07:50.345 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.example.springdemo.SpringDemoApplication for test class com.example.springdemo.SpringDemoApplicationTests
2021-06-17T07:37:50.4303907Z 13:07:50.428 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.springdemo.SpringDemoApplicationTests]: using defaults.
2021-06-17T07:37:50.4358665Z 13:07:50.428 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
2021-06-17T07:37:50.4483230Z 13:07:50.441 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
2021-06-17T07:37:50.4498231Z 13:07:50.442 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
2021-06-17T07:37:50.4527099Z 13:07:50.442 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@6f6745d6, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@27508c5d, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@4f704591, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@4b5189ac, org.springframework.test.context.support.DirtiesContextTestExecutionListener@1e4d3ce5, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@3ddc6915, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@704deff2, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@379614be, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@404bbcbd, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@1e81f160]
2021-06-17T07:37:50.4532060Z 13:07:50.445 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4541030Z 13:07:50.446 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4547093Z 13:07:50.448 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4556270Z 13:07:50.448 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4563456Z 13:07:50.448 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4573980Z 13:07:50.448 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4643860Z 13:07:50.451 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@6fa34d52 testClass = SpringDemoApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@57576994 testClass = SpringDemoApplicationTests, locations = ‘{}’, classes = ‘{class com.example.springdemo.SpringDemoApplication}’, contextInitializerClasses = ‘’, activeProfiles = ‘{}’, propertySourceLocations = ‘{}’, propertySourceProperties = ‘{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}’, contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@60015ef5, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@65b3f4a4, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@609db43b, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@52102734], resourceBasePath = ‘src/main/webapp’, contextLoader = ‘org.springframework.boot.test.context.SpringBootContextLoader’, parent = [null]], attributes = map[‘org.springframework.test.context.web.ServletTestExecutionListener.activateListener’ → true]], class annotated with @DirtiesContext [false] with mode [null].
2021-06-17T07:37:50.4654577Z 13:07:50.452 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4655396Z 13:07:50.452 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.springdemo.SpringDemoApplicationTests]
2021-06-17T07:37:50.4835257Z 13:07:50.481 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}
2021-06-17T07:37:50.7319759Z
2021-06-17T07:37:50.7331953Z . ____ _ __ _ _
2021-06-17T07:37:50.7332737Z /\ / __ _ () __ __ _ \ \ \
2021-06-17T07:37:50.7333255Z ( ( )_
_ | '_ | '| | ’ / ` | \ \ \
2021-06-17T07:37:50.7333708Z \/ )| |)| | | | | || (| | ) ) ) )
2021-06-17T07:37:50.7334152Z ’ |
| .__|| ||| |_, | / / / /
2021-06-17T07:37:50.7334583Z =========|
|==============|/=////
2021-06-17T07:37:50.7335042Z :: Spring Boot :: (v2.1.4.RELEASE)
2021-06-17T07:37:50.7344307Z
2021-06-17T07:37:50.8679369Z 2021-06-17 13:07:50.864 INFO 12036 — [ main] c.e.s.SpringDemoApplicationTests : Starting SpringDemoApplicationTests on PUNITP418995L with PID 12036 (started by PUNITP418995L$ in D:\Agent\vsts-agent-win-x64-2.187.2_work\1\s)
2021-06-17T07:37:50.8685604Z 2021-06-17 13:07:50.865 INFO 12036 — [ main] c.e.s.SpringDemoApplicationTests : No active profile set, falling back to default profiles: default
2021-06-17T07:37:52.7745853Z 2021-06-17 13:07:52.771 INFO 12036 — [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService ‘applicationTaskExecutor’
2021-06-17T07:37:53.1215125Z 2021-06-17 13:07:53.119 INFO 12036 — [ main] c.e.s.SpringDemoApplicationTests : Started SpringDemoApplicationTests in 2.627 seconds (JVM running for 3.456)
2021-06-17T07:37:53.4796805Z [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.452 s - in com.example.springdemo.SpringDemoApplicationTests
2021-06-17T07:37:53.4855859Z 2021-06-17 13:07:53.483 INFO 12036 — [ Thread-1] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService ‘applicationTaskExecutor’
2021-06-17T07:37:54.0515952Z [INFO]
2021-06-17T07:37:54.0516359Z [INFO] Results:
2021-06-17T07:37:54.0516637Z [INFO]
2021-06-17T07:37:54.0516998Z [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
2021-06-17T07:37:54.0517311Z [INFO]
2021-06-17T07:37:54.0591946Z [INFO]
2021-06-17T07:37:54.0592551Z [INFO] — maven-jar-plugin:3.1.1:jar (default-jar) @ spring-demo —
2021-06-17T07:37:54.2586019Z [INFO] Building jar: D:\Agent\vsts-agent-win-x64-2.187.2_work\1\s\target\spring-demo-0.0.1-SNAPSHOT.jar
2021-06-17T07:37:54.3009047Z [INFO]
2021-06-17T07:37:54.3013743Z [INFO] — spring-boot-maven-plugin:2.1.4.RELEASE:repackage (repackage) @ spring-demo —
2021-06-17T07:37:54.8881008Z [INFO] Replacing main artifact with repackaged archive
2021-06-17T07:37:54.8881615Z [INFO]
2021-06-17T07:37:54.8882195Z [INFO] — spring-boot-maven-plugin:2.1.4.RELEASE:repackage (default) @ spring-demo —
2021-06-17T07:37:54.9798574Z [INFO] Attaching repackaged archive D:\Agent\vsts-agent-win-x64-2.187.2_work\1\s\target\spring-demo-0.0.1-SNAPSHOT-spring-boot.jar with classifier spring-boot
2021-06-17T07:37:54.9825416Z [INFO]
2021-06-17T07:37:54.9826630Z [INFO] ----------------------< com.example:spring-demo >-----------------------
2021-06-17T07:37:54.9827925Z [INFO] Building spring-demo 0.0.1-SNAPSHOT
2021-06-17T07:37:54.9830355Z [INFO] --------------------------------[ jar ]---------------------------------
2021-06-17T07:37:55.0020924Z [INFO]
2021-06-17T07:37:55.0021642Z [INFO] — sonar-maven-plugin:3.9.0.2155:sonar (default-cli) @ spring-demo —
2021-06-17T07:37:55.2932238Z [INFO] User cache: C:\windows\ServiceProfiles\NetworkService.sonar\cache
2021-06-17T07:37:56.0986191Z [ERROR] SonarQube server [https://sonarqube.hitachi-powergrids.com] can not be reached
2021-06-17T07:37:56.0993851Z [INFO] ------------------------------------------------------------------------
2021-06-17T07:37:56.0994653Z [INFO] BUILD FAILURE
2021-06-17T07:37:56.0996596Z [INFO] ------------------------------------------------------------------------
2021-06-17T07:37:56.1016543Z [INFO] Total time: 8.617 s
2021-06-17T07:37:56.1018655Z [INFO] Finished at: 2021-06-17T13:07:56+05:30
2021-06-17T07:37:56.1021253Z [INFO] ------------------------------------------------------------------------
2021-06-17T07:37:56.1041821Z [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project spring-demo: Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target → [Help 1]
2021-06-17T07:37:56.1042698Z [ERROR]
2021-06-17T07:37:56.1044049Z [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
2021-06-17T07:37:56.1046303Z [ERROR] Re-run Maven using the -X switch to enable full debug logging.
2021-06-17T07:37:56.1046762Z [ERROR]
2021-06-17T07:37:56.1049299Z [ERROR] For more information about the errors and possible solutions, please read the following articles:
2021-06-17T07:37:56.1052252Z [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
2021-06-17T07:37:56.1920234Z The process ‘D:\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin\mvn.cmd’ failed with exit code 1
2021-06-17T07:37:56.1920794Z Could not retrieve code analysis results - Maven run failed.
2021-06-17T07:37:58.9639095Z ##[error]Build failed.
2021-06-17T07:37:58.9674007Z ##[section]Async Command Start: Publish test results
2021-06-17T07:37:58.9674338Z ##[section]Async Command End: Publish test results
2021-06-17T07:37:58.9837536Z ##[error]Forbidden
2021-06-17T07:37:58.9854108Z ##[section]Finishing: Maven pom.xml

From the above log i can recognize that there is some certificate issue even after i am providing my certificate file as an external variable to the pipeline.

Could you please help to solve this error.

@amit.saurabh I don’t know anything about certificate configuration, I’m afraid. There are quite a few other community posts about certificates, though. You might want to check whether any of those match your scenario.