为什么在执行sonar

为什么在执行sonar

本文介绍了为什么在执行sonar:sonar时找不到sonar-maven-plugin-3.0.1.jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前在持续的构建过程中包括(重新激活)声纳,并且遇到了一些问题.为了只专注于声纳,我试图使其在"HelloWorld"项目中运行,但仍然没有成功.

We are currently including (reactivating) sonar in our continuous build process and we are experiencing some issues.In order to focus only on sonar I tried to make it work on an "HelloWorld" project but still without any success.

repo1和repo2中似乎缺少一个jar(sonar-maven-plugin-3.0.1.jar).我已经浏览了这些位置,在这里只能找到pom.

One jar (sonar-maven-plugin-3.0.1.jar) seems to be missing from repo1 and repo2. I've browse those locations and only pom can be found here.

在以下网址上都找不到它:

Neither it can be found on the following url:

  • [http://www.java2s.com/Code/Jar/s/sonar.htm][1]
  • [http://mvnrepository.com/artifact/org.codehaus.sonar/sonar-maven-plugin/3.0.1][2]

到目前为止,我没有找到此罐子的任何存档版本.

So far I didn't found any archived version of this jar.

在这一点上,热烈欢迎任何帮助.

At this point any help is warmly welcome.

这是我的存储库(仅org \ codehaus \ mojo部分):

Here is my repo (only the org\codehaus\mojo part):

C:\maven-local-repo\org\codehaus\mojo>dir /s /b
C:\maven-local-repo\org\codehaus\mojo\maven-metadata-central.xml
C:\maven-local-repo\org\codehaus\mojo\maven-metadata-central.xml.sha1
C:\maven-local-repo\org\codehaus\mojo\mojo-parent
C:\maven-local-repo\org\codehaus\mojo\sonar-maven-plugin
C:\maven-local-repo\org\codehaus\mojo\mojo-parent\38
C:\maven-local-repo\org\codehaus\mojo\mojo-parent\38\mojo-parent-38.pom
C:\maven-local-repo\org\codehaus\mojo\mojo-parent\38\mojo-parent-38.pom.sha1
C:\maven-local-repo\org\codehaus\mojo\sonar-maven-plugin\3.0.1
C:\maven-local-repo\org\codehaus\mojo\sonar-maven-plugin\maven-metadata-central.xml
C:\maven-local-repo\org\codehaus\mojo\sonar-maven-plugin\maven-metadata-central.xml.sha1
C:\maven-local-repo\org\codehaus\mojo\sonar-maven-plugin\3.0.1\sonar-maven-plugin-3.0.1.pom
C:\maven-local-repo\org\codehaus\mojo\sonar-maven-plugin\3.0.1\sonar-maven-plugin-3.0.1.pom.sha1

这是我执行mvn sonar:sonar -X时得到的输出:

Here is the output I get when executing mvn sonar:sonar -X:

+ Error stacktraces are turned on.
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.7.0_51
Java home: C:\Tools\jdk1.7.0_51\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
[DEBUG] Building Maven user-level plugin registry from: 'C:\Users\a89632\.m2\plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: 'C:\Tools\apache-maven-2.2.1\conf\plugin-registry.xml'
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[DEBUG] Loading plugin prefixes from group: org.apache.maven.plugins
[DEBUG] Loading plugin prefixes from group: org.codehaus.mojo
[INFO] org.codehaus.mojo: checking for updates from central
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'Central' with url: 'http://repo1.maven.org/maven2/'.
[DEBUG] Using Proxy: ncproxy
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] artifact org.codehaus.mojo:sonar-maven-plugin: checking for updates from central
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'Central' with url: 'http://repo1.maven.org/maven2/'.
[DEBUG] Using Proxy: ncproxy
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] sonar-maven-plugin: resolved to version 3.0.1 from repository central
[DEBUG] Trying repository central
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'Central' with url: 'http://repo1.maven.org/maven2/'.
[DEBUG] Using Proxy: ncproxy
Downloading: http://repo1.maven.org/maven2//org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.pom
[DEBUG] attempting to create parent directories for destination: sonar-maven-plugin-3.0.1.pom.tmp
1/1K
1K downloaded  (sonar-maven-plugin-3.0.1.pom)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG]   Artifact resolved
[DEBUG] Retrieving parent-POM: org.codehaus.mojo:mojo-parent:pom:38 for project: org.codehaus.mojo:sonar-maven-plugin:pom:3.0.1 from the repository.
[DEBUG] Trying repository central
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'Central' with url: 'http://repo1.maven.org/maven2/'.
[DEBUG] Using Proxy: ncproxy
Downloading: http://repo1.maven.org/maven2//org/codehaus/mojo/mojo-parent/38/mojo-parent-38.pom
[DEBUG] attempting to create parent directories for destination: mojo-parent-38.pom.tmp
4/32K
8/32K
12/32K
16/32K
20/32K
24/32K
28/32K
31/32K
32/32K
32K downloaded  (mojo-parent-38.pom)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG]   Artifact resolved
[DEBUG] Adding managed dependencies for org.codehaus.mojo:sonar-maven-plugin
[DEBUG]   org.apache.maven:maven-plugin-api:jar:2.2.1
[DEBUG]   junit:junit:jar:4.12:test
[DEBUG]   org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.4
[DEBUG] While downloading org.codehaus.mojo:sonar-maven-plugin:3.0.1
  This artifact has been relocated to org.sonarsource.scanner.maven:sonar-maven-plugin:LATEST.
  SonarQube plugin was moved to SonarSource organisation


[DEBUG] sonar-maven-plugin: resolved to version 3.0.1 from repository central
[DEBUG] Retrieving parent-POM: org.sonarsource.parent:parent:pom:26 for project: org.sonarsource.scanner.maven:sonar-maven-plugin:maven-plugin:3.0.1 from the repository.
[DEBUG] Trying repository central
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'Central' with url: 'http://repo1.maven.org/maven2/'.
[DEBUG] Using Proxy: ncproxy
Downloading: http://repo1.maven.org/maven2//org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
[DEBUG] Unable to locate resource in repository
org.apache.maven.wagon.ResourceDoesNotExistException: Unable to locate resource in repository
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:139)
    at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
    at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
    at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
    at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:546)
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:427)
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:382)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:212)
    at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)
    at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:122)
    ... 27 more
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
    ... 27 more
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] Unable to find resource 'org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1' in repository central (http://repo1.maven.org/maven2)
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[INFO] Cannot find mojo descriptor for: 'sonar:sonar' - Treating as non-aggregator.
[DEBUG]
org.apache.maven.plugin.PluginNotFoundException: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:253)
    at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)
    at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:212)
    ... 18 more
[DEBUG] Wagons could not be registered as the extension container was never created
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype
[INFO]    task-segment: [sonar:sonar]
[INFO] ------------------------------------------------------------------------
[DEBUG] Trying repository central
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'Central' with url: 'http://repo1.maven.org/maven2/'.
[DEBUG] Using Proxy: ncproxy
Downloading: http://repo1.maven.org/maven2//org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
[DEBUG] Unable to locate resource in repository
org.apache.maven.wagon.ResourceDoesNotExistException: Unable to locate resource in repository
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:139)
    at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
    at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
    at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
    at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:546)
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:427)
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:382)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:212)
    at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)
    at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:568)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:122)
    ... 30 more
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/org/codehaus/mojo/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
    ... 30 more
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] Unable to find resource 'org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1' in repository central (http://repo1.maven.org/maven2)
[DEBUG] Using mirror: http://repo1.maven.org/maven2/ (id: Central)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.BuildFailureException: A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:544)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginNotFoundException: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=sonar-maven-plugin -Dversion=3.0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


  org.codehaus.mojo:sonar-maven-plugin:maven-plugin:3.0.1

from the specified remote repositories:
  Central (http://repo1.maven.org/maven2/)


    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:253)
    at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)
    at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:568)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
    ... 15 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
    at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
    at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:212)
    ... 21 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Feb 09 08:25:01 CET 2016
[INFO] Final Memory: 5M/122M
[INFO] ------------------------------------------------------------------------


  [1]: http://www.java2s.com/Code/Jar/s/sonar.htm
  [2]: http://mvnrepository.com/artifact/org.codehaus.sonar/sonar-maven-plugin/3.0.1

推荐答案

由于Codehaus项目的关闭,托管用于Maven的SonarQube扫描仪(又名SonarQube Maven插件)被移至其自己的groupId.新的groupId为org.sonarsource.scanner.maven.

Due to the shutdown of Codehaus project hosting the SonarQube Scanner for Maven (aka SonarQube Maven Plugin) was moved to its own groupId. The new groupId is org.sonarsource.scanner.maven.

org.codehaus.mojo是一种特殊情况,因为它已硬编码到Maven中,因此您无需任何配置即可使用mvn sonar:sonar.

org.codehaus.mojo was a special case since it is hardcoded into Maven so that you were able to use mvn sonar:sonar without any configuration.

为缓解过渡期,我们继续将重定位pom部署到旧的groupId .不幸的是,此重定位不适用于Maven2.这是一个已知问题,由于Maven 2是EOL,因此可能永远不会修复.

To ease the transition period we continue to deploy a relocation pom to the old groupId. Unfortunately this relocation doesn't work for Maven 2. This is a known issue that will probably never be fixed since Maven 2 is EOL.

因此,您有几种选择:

  1. 更新到Maven 3.x并从迁移中受益
  2. 在settings.xml的<pluginGroup>部分中添加org.sonarsource.scanner.maven,然后继续使用mvn sonar:sonar
  3. 在项目pom.xml(或公司父pom)中声明<plugin>条目,然后继续使用mvn sonar:sonar.在这里,这意味着您将锁定该插件的版本,这可能不是一件好事,这取决于您是否经常更新pom.xml.
  4. 使用完整的命令行:mvn org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar代替mvn sonar:sonar
  1. Update to Maven 3.x and benefit from the relocation
  2. Add org.sonarsource.scanner.maven in the <pluginGroup> section of your settings.xml and continue to use mvn sonar:sonar
  3. Declare <plugin> entry in your project pom.xml (or in corporate parent pom) and continue to use mvn sonar:sonar. Here it means you'll lock the version of the plugin that may be or not a good thing depending on your ability to update frequently you pom.xml.
  4. Use the full command line: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar instead of mvn sonar:sonar

请注意,只要允许我们部署重定位pom,更新到Maven 3(选项1)将使您从重定位中受益.因此,我建议您执行选项1,然后再考虑选项2或3或4,使其不再依赖重定位.

Note that updating to Maven 3 (option 1) will allow you to benefit from the relocation as long as we are allowed to deploy the relocation pom. So I advice to do option 1 but then also consider option 2 or 3 or 4 to no more rely on the relocation.

这篇关于为什么在执行sonar:sonar时找不到sonar-maven-plugin-3.0.1.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 10:05