0

Ich möchte meine maven Java-Anwendung mit SonarQube5.4 integrieren.Wie kann ich Maven Project mit SonarQube5.4 integrieren?

Mit maven3.3.3 und MySQL5.7.12

Bereits Sonarqube erfolgreich installiert und seine Lauf.

Wenn ich zu meinem Projektpfad gehe in Eingabeaufforderung und ausführen Befehl mvn sonar:sonar, Ich erhalte die folgenden Fehler

[WARNING] Failed to retrieve plugin descriptor for org.codehaus.sonar:sonar-maven-plugin:2.4: 
Plugin org.codehaus.sonar:sonar-maven-plugin:2.4 or one of its dependencies could not be resolved: 
Failed to read artifact descriptor for org.codehaus.sonar:sonar-maven-plugin:jar:2.4 
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/sonar-maven-plugin/maven-metadata.xml 
[WARNING] Could not transfer metadata org.codehaus.mojo:sonar-maven-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org 
[ERROR] Error resolving version for plugin 'org.codehaus.mojo:sonar-maven-plugin' 
from the repositories [local (C:\Users\username\.m2\repository), 
central (https://repo.maven.apache.org/maven2)]: 
Plugin not found in any plugin repository -> [Help 1] 

Aber wenn ich zu meinem .m2 Verzeichnis org/Codehaus/mojo/Sonar-Maven-Plugin Ich kann maven-metadata.xml finden. Auch ich kann sonar-maven-plugin-2.4.jar, sonar-maven-plugin-2.4.pom in org/Codehaus/mojo/Sonar-Maven-Plugin/2.4 Ordner

Ich bin verwirrt, verwenden Sie diese im lokalen Repository verfügbar sind, dann laden ihre versuchen zu?

Helfen Sie mir

finden Sie meine pom.xml unten

<?xml version="1.0"?> 

<project 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>org.mycompany.server</groupId> 
    <version>0.0.1-SNAPSHOT</version> 
    <artifactId>MyProject</artifactId> 
    <packaging>war</packaging> 
    <name>MyProject</name> 

    <properties> 
     <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> 
     <!-- External Dependencies versions --> 
     <build-helper-maven-plugin.version>1.7</build-helper-maven-plugin.version> 
     <hibernate.jpa.version>1.0.1.Final</hibernate.jpa.version> 
     <hibernate.validator.version>4.3.1.Final</hibernate.validator.version> 
     <hibernate.version>4.2.6.Final</hibernate.version> 
     <java.version>1.7</java.version> 
     <javax.servlet.jsp.version>2.1</javax.servlet.jsp.version> 
     <jaxb.version>2.2.4</jaxb.version> 
     <jsp-api.version>2.2</jsp-api.version> 
     <jstl.version>1.2</jstl.version> 
     <junit.version>4.11</junit.version> 
     <log4j.version>1.2.15</log4j.version> 
     <slf4j.log4j.version>1.6.1</slf4j.log4j.version> 
     <maven.assembly.plugin>2.3</maven.assembly.plugin> 
     <maven.clean.plugin>2.5</maven.clean.plugin> 
     <maven.compiler.plugin>2.0.2</maven.compiler.plugin> 
     <maven.dependency.plugin>2.4</maven.dependency.plugin> 
     <maven.deploy.plugin>2.7</maven.deploy.plugin> 
     <maven.eclipse.plugin>2.9</maven.eclipse.plugin> 
     <maven.exec.plugin>1.2.1</maven.exec.plugin> 
     <maven.install.plugin>2.3.1</maven.install.plugin> 
     <maven.jar.plugin>2.4</maven.jar.plugin> 
     <maven.plugin.plugin>3.1</maven.plugin.plugin> 
     <maven.surefire.plugin>2.12</maven.surefire.plugin> 
     <maven.tomcat.plugin>2.0-beta-1</maven.tomcat.plugin> 
     <maven.version.range>[2.2.1,3.1.0)</maven.version.range> 
     <maven.versions.plugin>1.3.1</maven.versions.plugin> 
     <maven.war.plugin>2.2</maven.war.plugin> 
     <oracle.version>6</oracle.version> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <servlet-api.version>3.0.1</servlet-api.version> 
     <spring.version>4.0.6.RELEASE</spring.version> 
     <apache.core.http>4.3.2</apache.core.http> 
     <apache.http.client>4.3.4</apache.http.client> 
     <json.lib.jdk5>2.4</json.lib.jdk5> 
     <signpost.commonhttp4>1.2.1.1</signpost.commonhttp4> 
     <signpost.core>1.2.1.1</signpost.core> 
     <json.version>20140107</json.version> 
     <google.oauth.client>1.15.0-rc</google.oauth.client> 
     <org.restlet.org>2.0</org.restlet.org> 
     <org.restlet>2.0.8</org.restlet> 
    </properties> 

    <build> 

     <plugins> 
      <plugin> 
       <groupId>org.codehaus.sonar</groupId> 
        <artifactId>sonar-maven-plugin</artifactId> 
       <version>2.4</version> 

      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 

       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.3</version> 

       <configuration> 
        <warName>MyPoriject</warName> 
        <webappDirectory>${webappDirectory}</webappDirectory> 

        <webResources> 

         <resource> 
          <filtering>true</filtering> 
          <directory>src/main/webapp</directory> 

          <includes> 
           <include>**/*.xml</include> 
          </includes> 
         </resource> 
        </webResources> 

        <archive> 

         <manifest> 
          <addDefaultImplementationEntries>true</addDefaultImplementationEntries> 
          <addClasspath>true</addClasspath> 
         </manifest> 
        </archive> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 

     <dependency> 
      <groupId>commons-beanutils</groupId> 
      <artifactId>commons-beanutils</artifactId> 
      <version>${commons.beanutils.version}</version> 

      <exclusions> 

       <exclusion> 
        <groupId>commons-logging</groupId> 
        <artifactId>commons-logging</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

     <dependency> 
      <groupId>commons-cli</groupId> 
      <artifactId>commons-cli</artifactId> 
      <version>${commons.cli.version}</version> 

      <exclusions> 

       <exclusion> 
        <groupId>junit</groupId> 
        <artifactId>junit</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 


     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
      <version>${servlet-api.version}</version> 
      <scope>provided</scope> 
     </dependency> 

     <dependency> 
      <groupId>javax.servlet.jsp</groupId> 
      <artifactId>jsp-api</artifactId> 
      <version>${jsp-api.version}</version> 
      <scope>provided</scope> 
     </dependency> 

     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
      <version>${jstl.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>javax.validation</groupId> 
      <artifactId>validation-api</artifactId> 
      <version>${validation-api.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>${junit.version}</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-validator</artifactId> 
      <version>${hibernate.validator.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-exec</artifactId> 
      <version>${commons.exec.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-test</artifactId> 
      <version>${spring.version}</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-beans</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>${spring.version}</version> 
      <scope>compile</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context-support</artifactId> 
      <version>${spring.version}</version> 
      <scope>compile</scope> 

      <exclusions> 

       <exclusion> 
        <groupId>quartz</groupId> 
        <artifactId>quartz</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

     <dependency> 
      <groupId>org.codehaus.jackson</groupId> 
      <artifactId>jackson-mapper-asl</artifactId> 
      <version>${jackson.version}</version> 
     </dependency> 
      <dependency> 
      <groupId>org.hamcrest</groupId> 
      <artifactId>hamcrest-all</artifactId> 
      <version>${hamcrest.version}</version> 
      <scope>test</scope> 
     </dependency> 


     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-webmvc</artifactId> 
      <version>${spring.version}</version> 
      <scope>compile</scope> 
     </dependency> 

    </dependencies> 
</project> 
+0

posten Sie Ihre pom.xml – Hohenheim

+0

versuchen, das Plugin von Sonar durch diese zu ersetzen: \t org.codehaus.sonar \t Sonar-maven3-Plugin \t 2,4 Hohenheim

+0

Fertig. Immer noch der gleiche Fehler – Prince

Antwort

0

haben Sie versucht, org/Codehaus/mojo/Sonar-Maven-Plugin von Ihnen lokalen Repo und starten Maven wieder zu entfernen?

+0

Ja entfernt es und führen Sie den Maven. Immer noch der gleiche Fehler. – Prince

+0

hast du die aktuelle Version des Plugins ausprobiert? org.codehaus.mojo Sonar-Maven-Plugin 3.0.1 UKoehler

+0

wenn es denken immer noch nicht funktioniert, ich eine Netzwerkverbindung Problem haben, Maven konnte das Artefakt nicht herunterladen. ...... Download: https://repo.maven.apache.org/maven2/org/codehaus/mojo/sonar-maven-plugin/maven-metadata.xml [WARNUNG] konnte Metadaten org.codehaus nicht übertragen .mojo: sonar-maven-plugin/maven-metadata.xml von/zu central (https://repo.maven.apache.org/maven2): repo.maven.apache.org [ERROR] Fehler beim Auflösen der Version für das Plugin 'org.codehaus.mojo: sonar-maven-plugin' – UKoehler