我面臨的問題與https://issues.apache.org/jira/browse/MNG-4001 類似,但帶有maven-sonar-plugin。
我正在使用的版本是: Jenkins-1.580.1,Jenkins-2.1中的SonarQube-plugin,使用Sonar 4.0和SonarQube 4.5.1嘗試過,但遇到相同的錯誤,sonar-maven-plugin:2.6 /2.7.1 )
當我在詹金斯配置中使用聲納後生成步驟我面對這個錯誤,這是常見的問題在不同的工作崗位看到
誤差爲什麼maven-sonar-plugin不存在?
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO] artifact org.apache.maven.plugins:maven-sonar-plugin: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-sonar-plugin: checking for updates from snapshots
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229)
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91)
at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179)
at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
... 15 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Dec 16 13:13:35 CET 2015
[INFO] Final Memory: 7M/238M
[INFO] ------------------------------------------------------------------------
Sonar analysis completed: FAILURE
Build step 'Sonar' changed build result to FAILURE
Build step 'Sonar' marked build as failure
Finished: FAILURE
爲什麼我面臨着這樣的錯誤?是詹金斯的Sonarqube插件的問題(bug)?
時間是避免這個錯誤我已經刪除了聲納後生成步驟,並添加了對Maven 3.0.4
Maven goals :: clean install -Dmaven.test.skip=true -Dsonar.jdbc.url=jdbc:postgresql://sonardb.test.com:5555/sonar -Dsonar.host.url=http://localhost:9000/sonar org.codehaus.mojo:sonar-maven-plugin:2.6:sonar <br>
在Maven目標聲吶分析步驟,但是這是一個臨時的解決方案,我想用聲納在我的作業配置中發佈構建步驟,而不會面臨此錯誤。
感謝您的幫助
我沒有在pom.xml中提到插件信息(路徑和版本),但它直接從某處取出,並且這是導致錯誤的原因。 除了提到pom.xml中的插件信息,還有其他的選擇嗎?因爲我會考慮編輯pom.xml作爲最後一個選項 –
您可以通過命令直接通過'mvn ... org.codehaus.mojo調用它:sonar-maven-plugin:2.7.1:GOAL' ... Best is把它放到一個pom(pluginManagement)中,這樣你就可以定義默認的值來執行,所以你不需要在命令行上給它們全部... – khmarbaise
我試過這個,但是這個解決方案的問題是我不能爲聲納分析選擇不同的jdk版本(例如,maven分析應該用jdk6完成,聲納分析用jdk7完成)。如果有一個後期構建步驟,我們可以選擇不同的jdk版本進行聲納分析,但是如果我們使用解決方案,你說(mvn ...)如何讓聲納使用jdk 7? –