Craig Leigh
Craig Leigh

Reputation: 1

Unable to build sonar project. Error: Cannot find parent: org.codehaus.sonar:sonar

Trying to build our java app using sonar for analysis. We are behind a firewall so no access to maven repo1. We do have a internal corp Artifactory for third party artifacts and a project Artifactory for our local stuff. I am the SCM guy in charge of our build server, not a developer. That said the application with junit tests builds fine. We have two goals clean install. The sonar server is 3.5.1 and the port set to 8080 instead of 9000 This is in our pom.

    <profile>
        <id>sonarJsEnabled</id>
        <properties>
            <srcDir>src/main/static</srcDir>
            <sonar.exclusions>libs/**/*,DSTCore/**/*,test/**/*</sonar.exclusions>
            <maven.test.skip>true</maven.test.skip>
            <sonar.language>js</sonar.language>
            <sonar.branch>js</sonar.branch>

        </properties>
    </profile>

    <profile>
        <id>sonarHtmlEnabled</id>
        <properties>
            <srcDir>src/main/static</srcDir>
            <sonar.language>web</sonar.language>
            <sonar.branch>web</sonar.branch>                                
            <sonar.web.fileExtensions>html,xhtml,jspf,jsp</sonar.web.fileExtensions>
            <maven.test.skip>true</maven.test.skip>
        </properties>
    </profile>
<profile>
   <id>sonar</id>
   <activation>
      <activeByDefault>true</activeByDefault>
   </activation>
   <properties>
      <!-- SERVER ON A REMOTE HOST -->
      <sonar.host.url>http://10.226.xx.xx:8080</sonar.host.url>
   </properties>
</profile>

and this:

           <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>1.0-beta-2</version>
            </plugin>

We add sonar:sonar When we build manually or with Bamboo we get this output.

C:\sonartest>mvn sonar:sonar [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'sonar'. [INFO] org.apache.maven.plugins: checking for updates from EnterpriseArchitectureRepo [INFO] org.codehaus.mojo: checking for updates from EnterpriseArchitectureRepo [INFO] artifact org.codehaus.mojo:sonar-maven-plugin: checking for updates from EnterpriseArchitectureRepo [INFO] Ignoring available plugin update: 2.0 as it requires Maven version 3.0 [INFO] Ignoring available plugin update: 2.0-beta-2 as it requires Maven version 3.0 [INFO] Ignoring available plugin update: 2.0-beta-1 as it requires Maven version 3.0 [INFO] ------------------------------------------------------------------------ [INFO] Building fundTrader [INFO] task-segment: [sonar:sonar] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [sonar:sonar {execution: default-cli}] [INFO] Sonar host: http://10.226.xx.xx:8080 [INFO] Sonar version: 3.5.1 [INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:3.5.1:sonar Downloading: http://repository.corp.net:8080/artifactory/libs-release/org/codehaus/sonar/sonar/3.5.1/sonar-3.5.1.pom [INFO] Unable to find resource 'org.codehaus.sonar:sonar:pom:3.5.1' in repository EnterpriseArchitectureRepo (http://repository.corp.net:8080/artifactory/libs-release) ... [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Can not execute Sonar

Embedded error: Unable to build project for plugin 'org.codehaus.sonar:sonar-maven-plugin': Cannot find parent: org.codehaus.sonar:sonar for project: null:sonar-maven-plugin:maven-plugin:null for project null:sonar-maven-plugin:maven-plugin:null Unable to download the artifact from any repository

Any help would be greatly apreciated.

Upvotes: 0

Views: 1316

Answers (1)

JBaruch
JBaruch

Reputation: 22893

I looks like the sonar-3.5.1.pom is not found. Consider adding Bintray's jcenter remote repository to your Artifactory (it has much more artifacts than Maven Center). The simplest way to do it is to import the jcenter configuration from an Artifactory instance at repo.jfrog.org. Just click on the Import -> Load and select jcenter from the list of loaded repository configurations.

Upvotes: 2

Related Questions