为什么在执行声纳时无法找到sonar-maven-plugin-3.0.1.jar:声纳?

时间:2016-02-09 08:11:07

标签: java maven jar sonarqube

我们目前在我们的持续构建过程中包括(重新激活)声纳,我们遇到了一些问题。 为了只关注声纳,我试图让它在“HelloWorld”项目上工作,但仍然没有任何成功。

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

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

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

此时热烈欢迎任何帮助。

这是我的回购(只有org \ codehaus \ mojo部分):

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时得到的输出:

+ 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

5 个答案:

答案 0 :(得分:5)

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

org.codehaus.mojo是一个特例,因为它被硬编码到Maven中,因此您可以在没有任何配置的情况下使用mvn sonar:sonar

为了缓解过渡期,我们继续将重新定位pom部署到old groupId。不幸的是,这种重新定位对Maven 2不起作用。这是一个known issue,由于Maven 2是EOL,因此可能永远无法修复。

所以你有几个选择:

  1. 更新到Maven 3.x并从重新安置中受益
  2. 在settings.xml的org.sonarsource.scanner.maven部分添加<pluginGroup>,然后继续使用mvn sonar:sonar
  3. 在项目<plugin>(或公司父母pom)中声明pom.xml条目并继续使用mvn sonar:sonar。这意味着您将锁定插件的版本,这可能是一件好事,也可能不是一件好事,具体取决于您经常更新pom.xml的能力。
  4. 使用完整命令行:mvn org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar代替mvn sonar:sonar
  5. 请注意,只要我们允许部署重定位pom,更新到Maven 3(选项1)将允许您从重定位中受益。所以我建议做选项1,但后来也考虑选项2或3或4,不再依赖于重新安置。

答案 1 :(得分:0)

我使用了http://search.maven.org并找到了sonar-maven-plugin版本3.0.1。

我可以跟踪https://repo1.maven.org/maven2/org/codehaus/sonar/sonar-maven-plugin/3.0.1/

那是你想要使用的onoe吗?这与堆栈跟踪中指定的相同。

你的maven设置如何?你之间有HttpProxy吗?你能用卷曲抓住神器吗?等。

来自你的堆栈跟踪:

[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

我怀疑使用org.codehaus.mojo:sonar-maven-plugin和org.codehaus.sonar:sonar-maven-plugin之间存在差异。我相信之前的版本在版本2.7.1之后停止了,它似乎给出了3.0和3.0.1的退役版本

答案 2 :(得分:0)

我在工作中遇到同样的问题。我通过删除本地存储库(.m2目录)来修复它。我们使用JFrog Artifactory作为代理,因此我也清除缓存。

答案 3 :(得分:0)

在settings.xml的部分添加“org.sonarsource.scanner.maven并继续使用mvn sonar:sonar”解决了我的问题。

答案 4 :(得分:0)

如果您使用的是sonarQube 7.6 声纳赛跑者2.4 Maven的3.6 Java Jdk 1.8

那么您可以放心地在pom.xml文件中使用以下代码集

<properties>
        <sonar.host.url>http://1localhost:9000/</sonar.host.url>
       </properties>

依赖项详细信息:

<dependency>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.6.0.1398</version>
              </dependency>

当然可以。 如果您在jenkins中使用带有声纳qube的管道项目,请使用以下常规代码,

stage('CodeCoverage') {
         steps {
             bat "mvn sonar:sonar"
         }
     }