为什么执行 sonar:sonar 时找不到 sonar-maven-plugin-3.0.1.jar?

2022-01-17 00:00:00 sonarqube java jar maven

我们目前在我们的持续构建过程中包含(重新激活)声纳,我们遇到了一些问题.为了只专注于声纳,我试图让它在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.

以下网址都找不到:

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

到目前为止,我还没有找到这个 jar 的任何存档版本.

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

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

At this point any help is warmly welcome.

这是我的仓库(只有 orgcodehausmojo 部分):

Here is my repo (only the orgcodehausmojo part):

C:maven-local-repoorgcodehausmojo>dir /s /b
C:maven-local-repoorgcodehausmojomaven-metadata-central.xml
C:maven-local-repoorgcodehausmojomaven-metadata-central.xml.sha1
C:maven-local-repoorgcodehausmojomojo-parent
C:maven-local-repoorgcodehausmojosonar-maven-plugin
C:maven-local-repoorgcodehausmojomojo-parent38
C:maven-local-repoorgcodehausmojomojo-parent38mojo-parent-38.pom
C:maven-local-repoorgcodehausmojomojo-parent38mojo-parent-38.pom.sha1
C:maven-local-repoorgcodehausmojosonar-maven-plugin3.0.1
C:maven-local-repoorgcodehausmojosonar-maven-pluginmaven-metadata-central.xml
C:maven-local-repoorgcodehausmojosonar-maven-pluginmaven-metadata-central.xml.sha1
C:maven-local-repoorgcodehausmojosonar-maven-plugin3.0.1sonar-maven-plugin-3.0.1.pom
C:maven-local-repoorgcodehausmojosonar-maven-plugin3.0.1sonar-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:Toolsjdk1.7.0_51jre
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:Usersa89632.m2plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: 'C:Toolsapache-maven-2.2.1confplugin-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

推荐答案

由于托管 SonarQube Scanner for Maven(又名 SonarQube Maven 插件)的 Codehaus 项目关闭,已移至其自己的 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.不幸的是,此重定位不适用于 Maven 2.这是 已知问题可能永远不会修复,因为 Maven 2 已停产.

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 的 部分添加 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.

相关文章