Error in Travis Log: "You're not authorized to run analysis. Please contact the project administrator" and Travis CI org not sending Jacoco reports to SonarCloud

In travis-ci-org i am getting below error :

[INFO] Detected project binding: ERROR
[INFO] Check ALM binding of project ‘attsd.exam.project:spring-project’ (done) | time=118ms
[INFO] Load project pull requests
[INFO] Load project pull requests (done) | time=118ms
[INFO] Load branch configuration
[INFO] Load branch configuration (done) | time=3ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=284ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=3808ms
[INFO] Organization key: josephthachilgeorge
[INFO] Indexing files…
[INFO] Project configuration:
[INFO] Excluded sources for coverage: **/model/., **/SpringProjectApplication.*, /config/
[INFO] Load project repositories
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.878 s
[INFO] Finished at: 2020-06-07T23:23:59Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project spring-project: You’re not authorized to run analysis. Please contact the project administrator. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The command “mvn -f spring-project/pom.xml -Pjacoco clean verify sonar:sonar” exited with 1.
1.47s$ mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=JosephThachilGeorge_ATTSDExamMasterProject
[INFO] Scanning for projects…
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.091 s
[INFO] Finished at: 2020-06-07T23:24:00Z
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/travis/build/JosephThachilGeorge/ATTSDExamMasterProject). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
The command “mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=JosephThachilGeorge_ATTSDExamMasterProject” exited with 1.
cache.2
store build cache

In My sonar-project.properties has below configuration

sonar.host.url=https://sonarcloud.io
sonar.organization=organizational-name
sonar.projectKey=projectkey
sonar.login= ${loginToken}
sonar.sources=./src
sonar.tests=./src

In My .travis.yml has below configuration

Java

dist: xenial

jdk: openjdk8

git:
depth: false

services:

  • docker
  • xvfb

addons:
sonarcloud:
organization: “xxxxxxxxxxxxxxx”
token: ${loginToken}

install: true

cache:
directories:
- $HOME/.m2
- $HOME/.sonar/cache

script:

  • mvn -f spring-project/pom.xml -Pjacoco clean verify sonar:sonar
  • mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=ProjectKey

Additional information:

${loginToken}= has taken from Sonarcloude->My Organization->Security-> Generate Tokens
My Organization has also given Execute analysis permission

Kindly help me to solve
Please let me know if you require further details.

Anyone could help me.I am waiting for your reply

Hello Jospeh,

could it be you ran the command from the wrong location?
or do you intend to run maven without a pom.xml?

Best.

Hi Olivier Schmitt,

Thanks for your reply!

Yes i want to include Pom while building

My travis.yml is in below location

My Pom file is in below location


In pom i have configuration :

I have put goal as

Is it right ? or my command is wrong ?

Hello @JosephThachilGeorge,

Did you encrypt your SonarCloud token as is described in this guide (Step 2: encrypt this token)?

When scanning with maven you also don’t need the sonar-project.properties file, and of the properties you have configured in the sonar-project.properties file only a few are needed. You can add the following properties to your pom.xml and delete the sonar-project.properties file

  <properties>
    <sonar.projectKey>YOUR_PROJECT_KEY_ON_SONARCLOUD</sonar.projectKey>
    <sonar.sources>./src</sonar.sources>
    <sonar.tests>./src</sonar.tests>
  </properties>

Hi Tom Van ,
Thanks for your reply
Following steps i have done
Steps 1:
Yes i have encrypted below key using command travis encrypt SOMEVAR=*******

image

Step 2:

Add encrypt key in travis.yml as shown below :

Step 3:

In pom file added following property :

Step 4:

delete sonar-project.properties file

Then build goes error as shown below :

Please let me know if i am wrong anywhere ?
Once again thanks for your help

Hi @JosephThachilGeorge,

I suspect there might be something wrong with the configuration of the organization and projectKey, could you double check that both the value in .travis.yml and pom.xml match the organization and project keys on SonarCloud?

If that doesn’t resolve it you should add the following property to your pom.xml

<sonar.log.level>DEBUG</sonar.log.level>

and share the output of that build.

Hi @TomVanBraband

I have double checked the properties in pom and travis.yml and then with Sonarcloude. it is same

Travis.yml

Sonarcloude

After adding <sonar.log.level>DEBUG</sonar.log.level> property in pom file i got below build :

12:09:43.894 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper=true, server.port=-1}
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.4.RELEASE)
2020-06-16 12:09:44.553  INFO 4760 --- [           main] a.e.s.a.p.r.AirlineserviceRepositoryTest : Starting AirlineserviceRepositoryTest on localhost with PID 4760 (started by travis in /home/travis/build/JosephThachilGeorge/Spring-ProjectATTSD/spring-project)
2020-06-16 12:09:44.557  INFO 4760 --- [           main] a.e.s.a.p.r.AirlineserviceRepositoryTest : No active profile set, falling back to default profiles: default
2020-06-16 12:09:46.511  INFO 4760 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration, org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManagerAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@40f8f5a8, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@62628e78, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@4b718c45, org.springframework.boot.test.autoconfigure.filter.TypeExcludeFiltersContextCustomizer@351584c0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@81341e06, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@e4b6f47], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@6cdb907]; rollback [true]
Hibernate: call next value for hibernate_sequence
Hibernate: insert into airlineservice (average_price, name, id) values (?, ?, ?)
Hibernate: select airlineser0_.id as id1_0_0_, airlineser0_.average_price as average_2_0_0_, airlineser0_.name as name3_0_0_ from airlineservice airlineser0_ where airlineser0_.id=?
Hibernate: call next value for hibernate_sequence
Hibernate: insert into airlineservice (average_price, name, id) values (?, ?, ?)
Hibernate: select airlineser0_.id as id1_0_0_, airlineser0_.average_price as average_2_0_0_, airlineser0_.name as name3_0_0_ from airlineservice airlineser0_ where airlineser0_.id=?
Hibernate: call next value for hibernate_sequence
Hibernate: insert into airlineservice (average_price, name, id) values (?, ?, ?)
Hibernate: select airlineser0_.id as id1_0_0_, airlineser0_.average_price as average_2_0_0_, airlineser0_.name as name3_0_0_ from airlineservice airlineser0_ where airlineser0_.id=?
Hibernate: call next value for hibernate_sequence
Hibernate: insert into airlineservice (average_price, name, id) values (?, ?, ?)
Hibernate: select airlineser0_.id as id1_0_0_, airlineser0_.average_price as average_2_0_0_, airlineser0_.name as name3_0_0_ from airlineservice airlineser0_ where airlineser0_.id=?
Hibernate: select airlineser0_.id as id1_0_, airlineser0_.average_price as average_2_0_, airlineser0_.name as name3_0_ from airlineservice airlineser0_ order by airlineser0_.name
2020-06-16 12:09:51.489  INFO 4760 --- [           main] o.s.t.c.transaction.TransactionContext   : Rolled back transaction for test: [DefaultTestContext@54af9cce testClass = AirlineserviceRepositoryTest, testInstance = attsd.exam.spring.airlineservice.project.repositories.AirlineserviceRepositoryTest@6ca8e30f, testMethod = findAllTheAirlineservicesOrderByName@AirlineserviceRepositoryTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@683218c8 testClass = AirlineserviceRepositoryTest, locations = '{}', classes = '{class attsd.exam.spring.airlineservice.project.SpringProjectMainApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper=true}', contextCustomizers = set[[ImportsContextCustomizer@3eb6d7a9 key = [org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration, org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManagerAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@40f8f5a8, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@62628e78, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@4b718c45, org.springframework.boot.test.autoconfigure.filter.TypeExcludeFiltersContextCustomizer@351584c0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@81341e06, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@e4b6f47], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.711 s - in attsd.exam.spring.airlineservice.project.repositories.AirlineserviceRepositoryTest
[INFO] Running attsd.exam.spring.airlineservice.project.controllers.AirlineserviceRestControllerRestAssuredTest
2020-06-16 12:09:52.501  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:52.505  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:52.511  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 4 ms
2020-06-16 12:09:53.052  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:53.054  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:53.055  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 0 ms
2020-06-16 12:09:53.115  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:53.116  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:53.118  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 2 ms
2020-06-16 12:09:54.164  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:54.166  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:54.168  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 0 ms
2020-06-16 12:09:54.203  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:54.205  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:54.207  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 0 ms
2020-06-16 12:09:54.337  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:54.339  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:54.340  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 0 ms
2020-06-16 12:09:54.403  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:54.404  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:54.405  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 1 ms
2020-06-16 12:09:54.469  INFO 4760 --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:54.470  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:54.472  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 2 ms
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.982 s - in attsd.exam.spring.airlineservice.project.controllers.AirlineserviceRestControllerRestAssuredTest
[INFO] Running attsd.exam.spring.airlineservice.project.controllers.LoginControllerTest
2020-06-16 12:09:54.505  INFO 4760 --- [           main] .b.t.a.w.s.WebMvcTestContextBootstrapper : Neither @ContextConfiguration nor @ContextHierarchy found for test class [attsd.exam.spring.airlineservice.project.controllers.LoginControllerTest], using SpringBootContextLoader
2020-06-16 12:09:54.509  INFO 4760 --- [           main] o.s.t.c.support.AbstractContextLoader    : Could not detect default resource locations for test class [attsd.exam.spring.airlineservice.project.controllers.LoginControllerTest]: no resource found for suffixes {-context.xml, Context.groovy}.
2020-06-16 12:09:54.509  INFO 4760 --- [           main] t.c.s.AnnotationConfigContextLoaderUtils : Could not detect default configuration classes for test class [attsd.exam.spring.airlineservice.project.controllers.LoginControllerTest]: LoginControllerTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
2020-06-16 12:09:54.533  INFO 4760 --- [           main] .b.t.c.SpringBootTestContextBootstrapper : Found @SpringBootConfiguration attsd.exam.spring.airlineservice.project.SpringProjectMainApplication for test class attsd.exam.spring.airlineservice.project.controllers.LoginControllerTest
2020-06-16 12:09:54.536  INFO 4760 --- [           main] .b.t.a.w.s.WebMvcTestContextBootstrapper : 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, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener, org.springframework.security.test.context.support.ReactorContextTestExecutionListener]
2020-06-16 12:09:54.547  INFO 4760 --- [           main] .b.t.a.w.s.WebMvcTestContextBootstrapper : Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@7d7a0337, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@6894c9e3, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@25099dba, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@7c9834b1, org.springframework.test.context.support.DirtiesContextTestExecutionListener@51d6e3ae, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1fc3e3a6, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@76ce59a9, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener@4b4ed67d, org.springframework.security.test.context.support.ReactorContextTestExecutionListener@2d639729, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@2d3d9ff0, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@293a98ef, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@147a4e8b, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@259149f2, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@641290af]
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.4.RELEASE)
2020-06-16 12:09:54.614  INFO 4760 --- [           main] a.e.s.a.p.c.LoginControllerTest          : Starting LoginControllerTest on localhost with PID 4760 (started by travis in /home/travis/build/JosephThachilGeorge/Spring-ProjectATTSD/spring-project)
2020-06-16 12:09:54.622  INFO 4760 --- [           main] a.e.s.a.p.c.LoginControllerTest          : No active profile set, falling back to default profiles: default
2020-06-16 12:09:56.073  INFO 4760 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@126dc5e7, org.springframework.security.web.context.SecurityContextPersistenceFilter@4d2f1ce5, org.springframework.security.web.header.HeaderWriterFilter@34d25f0d, org.springframework.security.web.authentication.logout.LogoutFilter@ae4d3ef, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@11d1610c, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@46c5f256, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7cd8920a, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@42f1b419, org.springframework.security.web.session.SessionManagementFilter@7e6f38bd, org.springframework.security.web.access.ExceptionTranslationFilter@53c984df, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5544d0bd]
2020-06-16 12:09:56.746  INFO 4760 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-06-16 12:09:57.007  INFO 4760 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2020-06-16 12:09:57.219  INFO 4760 --- [           main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:57.224  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:57.243  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 15 ms
2020-06-16 12:09:57.285  INFO 4760 --- [           main] a.e.s.a.p.c.LoginControllerTest          : Started LoginControllerTest in 2.732 seconds (JVM running for 19.781)
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.549 s - in attsd.exam.spring.airlineservice.project.controllers.LoginControllerTest
[INFO] Running attsd.exam.spring.airlineservice.project.controllers.AirlineserviceWebControllerTest
2020-06-16 12:09:58.054  INFO 4760 --- [           main] .b.t.a.w.s.WebMvcTestContextBootstrapper : Neither @ContextConfiguration nor @ContextHierarchy found for test class [attsd.exam.spring.airlineservice.project.controllers.AirlineserviceWebControllerTest], using SpringBootContextLoader
2020-06-16 12:09:58.055  INFO 4760 --- [           main] o.s.t.c.support.AbstractContextLoader    : Could not detect default resource locations for test class [attsd.exam.spring.airlineservice.project.controllers.AirlineserviceWebControllerTest]: no resource found for suffixes {-context.xml, Context.groovy}.
2020-06-16 12:09:58.056  INFO 4760 --- [           main] t.c.s.AnnotationConfigContextLoaderUtils : Could not detect default configuration classes for test class [attsd.exam.spring.airlineservice.project.controllers.AirlineserviceWebControllerTest]: AirlineserviceWebControllerTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
2020-06-16 12:09:58.062  INFO 4760 --- [           main] .b.t.c.SpringBootTestContextBootstrapper : Found @SpringBootConfiguration attsd.exam.spring.airlineservice.project.SpringProjectMainApplication for test class attsd.exam.spring.airlineservice.project.controllers.AirlineserviceWebControllerTest
2020-06-16 12:09:58.063  INFO 4760 --- [           main] .b.t.a.w.s.WebMvcTestContextBootstrapper : 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, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener, org.springframework.security.test.context.support.ReactorContextTestExecutionListener]
2020-06-16 12:09:58.065  INFO 4760 --- [           main] .b.t.a.w.s.WebMvcTestContextBootstrapper : Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@438cdad9, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@2e247303, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@2f7dd12c, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@76c9d3b0, org.springframework.test.context.support.DirtiesContextTestExecutionListener@533695a2, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5e8758ac, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@1fb206e1, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener@27de02f4, org.springframework.security.test.context.support.ReactorContextTestExecutionListener@40221828, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@24846ab8, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@2b8ef5c7, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@7c909be0, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@2c233f02, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@2b755194]
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.4.RELEASE)
2020-06-16 12:09:58.095  INFO 4760 --- [           main] .s.a.p.c.AirlineserviceWebControllerTest : Starting AirlineserviceWebControllerTest on localhost with PID 4760 (started by travis in /home/travis/build/JosephThachilGeorge/Spring-ProjectATTSD/spring-project)
2020-06-16 12:09:58.097  INFO 4760 --- [           main] .s.a.p.c.AirlineserviceWebControllerTest : No active profile set, falling back to default profiles: default
2020-06-16 12:09:58.409  INFO 4760 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 
Using generated security password: 25593b0e-cade-4a6a-b3e4-65743d71a6e8
2020-06-16 12:09:58.453  INFO 4760 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@309407b0, org.springframework.security.web.context.SecurityContextPersistenceFilter@2c955340, org.springframework.security.web.header.HeaderWriterFilter@71eca4dd, org.springframework.security.web.authentication.logout.LogoutFilter@16058434, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@43644bc3, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2b99fc5c, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3f477fbe, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@54b6166, org.springframework.security.web.session.SessionManagementFilter@2c10bf75, org.springframework.security.web.access.ExceptionTranslationFilter@31c6c9bf, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@49598a74]
2020-06-16 12:09:58.526  INFO 4760 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-06-16 12:09:58.572  INFO 4760 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2020-06-16 12:09:58.593  INFO 4760 --- [           main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet ''
2020-06-16 12:09:58.593  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Initializing Servlet ''
2020-06-16 12:09:58.596  INFO 4760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Completed initialization in 3 ms
2020-06-16 12:09:58.611  INFO 4760 --- [           main] .s.a.p.c.AirlineserviceWebControllerTest : Started AirlineserviceWebControllerTest in 0.54 seconds (JVM running for 21.107)
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.793 s - in attsd.exam.spring.airlineservice.project.controllers.AirlineserviceWebControllerTest
2020-06-16 12:09:58.898  INFO 4760 --- [       Thread-8] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2020-06-16 12:09:58.904  INFO 4760 --- [       Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-06-16 12:09:58.908  INFO 4760 --- [       Thread-4] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
2020-06-16 12:09:58.894  INFO 4760 --- [       Thread-6] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
Hibernate: drop table airlineservice if exists
Hibernate: drop sequence if exists hibernate_sequence
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 39, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) @ spring-project ---
[INFO] Building jar: /home/travis/build/JosephThachilGeorge/Spring-ProjectATTSD/spring-project/target/spring-project-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.4.RELEASE:repackage (repackage) @ spring-project ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.4.RELEASE:repackage (default) @ spring-project ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:report (default) @ spring-project ---
[INFO] Loading execution data file /home/travis/build/JosephThachilGeorge/Spring-ProjectATTSD/spring-project/target/jacoco.exec
[INFO] Analyzed bundle 'spring-project' with 6 classes
[INFO] 
[INFO] -----------------< attsd.exam.project:spring-project >------------------
[INFO] Building spring-project 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in https://maven-central.storage-download.googleapis.com/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of google-maven-central has elapsed or updates are forced
[INFO] 
[INFO] --- sonar-maven-plugin:3.6.0.1398:sonar (default-cli) @ spring-project ---
[INFO] User cache: /home/travis/.sonar/cache
[INFO] SonarQube version: 8.0.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31.943 s
[INFO] Finished at: 2020-06-16T12:10:03Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project spring-project: Unable to load component class org.sonar.scanner.bootstrap.ScannerPluginInstaller: Unable to load component class org.sonar.scanner.bootstrap.PluginFiles: Unable to load component class org.sonar.scanner.bootstrap.GlobalConfiguration: Unable to load component class org.sonar.scanner.bootstrap.GlobalServerSettings: Not authorized. Please check the properties sonar.login and sonar.password. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The command "mvn -f spring-project/pom.xml -Pjacoco clean verify sonar:sonar" exited with 1.
1.45s$ mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=JosephThachilGeorge_Spring-ProjectATTSD
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.115 s
[INFO] Finished at: 2020-06-16T12:10:04Z
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/travis/build/JosephThachilGeorge/Spring-ProjectATTSD). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
The command "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=JosephThachilGeorge_Spring-ProjectATTSD" exited with 1.
cache.2
store build cache
Done. Your build exited with 1.

Hello @JosephThachilGeorge,

I can confirm that the problem is not with your configuration of the project or organization key.

I can replicate your exact behaviour when I supply a wrong token, so it seems that your token configuration is invalid.
To double-check this you can execute: echo $SONARQUBE_SCANNER_PARAMS before you execute the mvn command. This will log the original token you have supplied to the sonarcloud addon as the value of sonar.login, you can use this to double-check the value of your token.

Hi @TomVanBraband

Do you mean that in travis.yml , before maven execute i have to put the command $SONARQUBE_SCANNER_PARAMS ?

I have done that then build is not working

Hi @TomVanBraband

Some more details i have to mention now :slight_smile:
I tried same using command prompt with out travis :slight_smile:
Below steps i followed
Step 1:
Added below details in Pom :

Step 2:

Went to root folder for project and typed below command and tried to run without travis .

image

Then i got below error for build

I feel it is not connecting to https://sonarcloud.io/ ? Where is the mistake ?

Hello @JosephThachilGeorge,

Could you check the java version you are running mvn verify sonar:sonar in your last post?
You can do this by checking the output of mvn --version. It is very likely that switching to a recent version of Java (11 for example) would fix your issue.

If that does not fix the error you are running into you can look into the accepted answer on this stackoverflow post.

Please let me know if you managed to fix this, and what steps you had to take.

Hi @TomVanBraband
Step 1:
i changed in to Java 11
image

My Java version is 1.8

Step 2:

tried again mvn verify sonar:sonar

I have got same error in build

Step 3
Tried to do steps in " stackoverflow"

In stackoverflow mentioned below step:

image

but in there is no option as export as you can see below : “show certificate” > “details” > “export…”

Hi @TomVanBraband

for some reason i can not install Java 11 in my PC because Java 1.8 is needed for some of my other projects

Hi @TomVanBraband
Is there ANY update on this task ?

Hello @JosephThachilGeorge,

Please remain polite, this is not a service you are paying for.

It is possible to have multiple Java versions installed on your PC. You can at anytime specify which version you want to use by setting the JAVA_HOME environment variable.

I’m pretty sure that the option “Copy to File…” is the option you want to use. This will allow you to continue with the next step.

A small note on the properties you have set (now in your pom.xml): you should not need the sonar.sources and sonar.tests properties, the defaults should work fine for your case.

Hi @TomVanBraband.

Thanks for your kind reply. Sorry for disturbing you more.

As per your suggestion i have removed sonar.sources and sonar.tests from Pom.

Then , i tried below steps , Could you please verify is there any mistake in my steps.

Step : 1

Export .cer file in to jre bin folder with the name “example.cer” as shown below :

Step 2

Using command prompt i typed :

C:\Program Files\Java\jre1.8.0_221\bin>keytool -import -alias example -keystore C:\Program Files\Java\jre1.8.0_221\lib\security\cacerts -file example.cer

Then result was :

I tried with different ways , changing with file name. But i am getting same error. I am sure somewhere wrong in my command, If possible let me know where i am wrong ?.

The path to the cacerts file contains a space, so you need to enclose it in double-quotes:

keytool -import -alias example -keystore "C:\Program Files\Java\jre1.8.0_221\lib\security\cacerts" -file example.cer
1 Like

Hi @janos , As per your suggestion i have done , it worked . thanks a lot

Hi @TomVanBraband and @janos

I followed below steps

Step 1:
Import certificate successfully

Step 2:
Restart the PC

Step 3:

Removed sonar.sources and sonar.tests from Pom

image

Step 4:

Run in Command prompt : mvn verify sonar:sonar

Below result got after building

Kindly let me know if i need to do any other changes , Once again thank you for your support and being patient with me: :slight_smile:

Hello @JosephThachilGeorge,

I think you’re very close.

You posted the output from running mvn --version and in that output it shows that maven is using Java on the path C:\Program Files\Java\jdk1.8.0_221\jre.

However you added the certificate to C:\Program Files\Java\jre1.8.0_221 so this will not have any effect since this JRE is not used by maven. Could you try adding the certificate to C:\Program Files\Java\jdk1.8.0_221\jre?