Maven命令:
mvn clean install failsafe:integration-test sonar:sonar -Dsonar.branch.name=sonarTestBranch -Dsonar.projectKey=ABC-SonarTest -Dsonar.host.url=https://sonarqube.abc.com -Dsonar.login=*****
出现以下错误:
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project ABC-SonarTest : Not authorized. Please check the properties sonar.login and sonar.password.
有人可以提出一些解决方案吗 oneLogin在sonarqube中实现。在此oneLogin实施之前,没有错误。
Pom.xml
<pre>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<!-- When using '@Category( MyUnitTest.class)': MyUnitTest</groups>-->
<skipTests>false</skipTests>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
<!-- optional: works also when skipped -->
<forkCount>1</forkCount>
<argLine>${jvm.options}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${encoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.tesco.tps.usermanagement.UserManagementApplication</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<!--<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.3</version>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19</version>
</plugin>
</plugins>
</reporting>
</pre>
如何将声纳尔贝集成到我的项目中?
需要sonar.password吗?如果我给声纳密码也失败了。我正在给-Dsonar.password = ****,但是在那之后也失败了。
POM中的依赖性是否存在任何问题。如果我正在使用sonarqube的服务帐户运行此詹金斯,那么我也面临同样的问题,其中其他项目可以通过服务帐户的SONAR.LOGIN正常运行。