Openshift : Fabric deployment fails with while building image - maven

I am trying to deploy the sample project using Fabric8 Maven plugin.
https://github.com/jbossdemocentral/katacoda-fuse-getting-started.git
I have a up and running Openshift environment in remote machine and I am connecting to it using "oc login ....."
Local Development Machine Setup: has docker, maven. oc installed.
OS: Mac OS
> docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:20:08 2016
OS/Arch: darwin/amd64
Server:
Version: 18.05.0-ce
API version: 1.37
Go version: go1.10.1
Git commit: f150324
Built: Wed May 9 22:20:42 2018
OS/Arch: linux/amd64
>> oc version
oc v3.9.25
kubernetes v1.9.1+a0ce1bc657
When I run the sample project "mvn fabric8:deploy" from command prompt, the build fails with
Error Logs:
[DEBUG] Trying to configure client from Kubernetes config...
[DEBUG] Found for Kubernetes config at: [/Users/apiteam/.kube/config].
[WARNING] F8: Cannot access cluster for detecting mode: Unknown host placholder.openshiftenv.com
[INFO] F8: Building Docker image in Kubernetes mode
[INFO] F8: spring-boot: Using fat jar packaging as the spring boot plugin is using `repackage` goal execution
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Docker image jboss-fuse-6/fis-java-openshift:2.0 as base / builder
[ERROR] F8: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:22 min
[INFO] Finished at: 2018-05-15T14:42:21+05:30
[INFO] Final Memory: 52M/400M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build (default) on project fuse-camel-sb-rest: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0': Get https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0: Get https://auth.docker.io/token?scope=repository%3Ajboss-fuse-6%2Ffis-java-openshift%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) (Internal Server Error: 500) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:3.1.80.redhat-000010:build (default) on project fuse-camel-sb-rest: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: I/O Error executing build for image [fuse/fuse-camel-sb-rest:snapshot-180515-144114-0343] "spring-boot":io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
at io.fabric8.maven.plugin.mojo.build.BuildMojo.buildAndTag(BuildMojo.java:242)
at io.fabric8.maven.docker.BuildMojo.executeInternal(BuildMojo.java:47)
at io.fabric8.maven.plugin.mojo.build.BuildMojo.executeInternal(BuildMojo.java:218)
at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:193)
at io.fabric8.maven.plugin.mojo.build.BuildMojo.execute(BuildMojo.java:201)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 24 more
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Unable to pull 'jboss-fuse-6/fis-java-openshift:2.0'
at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.pullImage(DockerAccessWithHcClient.java:369)
at io.fabric8.maven.docker.AbstractDockerMojo.checkImageWithAutoPull(AbstractDockerMojo.java:439)
at io.fabric8.maven.docker.AbstractBuildSupportMojo.autoPullBaseImage(AbstractBuildSupportMojo.java:110)
at io.fabric8.maven.docker.AbstractBuildSupportMojo.buildImage(AbstractBuildSupportMojo.java:63)
at io.fabric8.maven.docker.BuildMojo.buildAndTag(BuildMojo.java:56)
at io.fabric8.maven.plugin.mojo.build.BuildMojo.buildAndTag(BuildMojo.java:235)
... 30 more
Caused by: io.fabric8.maven.docker.access.hc.http.HttpRequestException: Get https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0: Get https://auth.docker.io/token?scope=repository%3Ajboss-fuse-6%2Ffis-java-openshift%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) (Internal Server Error: 500)
at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate$StatusCodeCheckerResponseHandler.handleResponse(ApacheHttpClientDelegate.java:177)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)
at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.post(ApacheHttpClientDelegate.java:97)
at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.pullImage(DockerAccessWithHcClient.java:366)
... 35 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I followed the instructions given in the Redhat site and setup the local environment with docker, oc and access to Openshift environment from local machine via oc login. Also, I dont have much knowledge on the openshift environment thats running remotely, I got only openshift console and the token with which am connecting from local machine.
So, now the questions I have are
Is there any additional setup required to use fabric8 in Local machine?
As mentioned already, am not aware if fabric8 is installed on top of openshift platform. Is it mandatory to have fabric8 on openshift setup or openshift provides this out of the box.
I checked in openshift console, it has got "jboss-fuse-6/fis-java-openshift:2.0" imagestreams. Do I need to get the docker internal repository url of the openshift platform and should this needs to be configured in the source code somewhere? In logs "https://registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift/manifests/2.0", where this comes from - I dont seem to find this configuration in source code. Does fabric8 automatically connects to the Internal docker registry of openshift env?
When the "mvn fabric8:deploy" is run, my understanding is "Project is compiled locally, Local docker connects to the Openshift environment and pulls the base images (in this case 'jboss-fuse-6/fis-java-openshift:2.0') into Local machine and builds the final images and deploys to openshift environment". Is this correct or - is it the other away around i.e, the springboot jar, docker images are built inside openshift platform and deployed too?
Should my profile in openshift also needs to have access to Internal Openshift Registry to pull docker images?
Can someone please clarify the doubts and help with the issue?

If you use OpenShift and fabric8 s2i build, local setup is not
required. All builds and deployments run in OpenShift. The error
shows that OpenShift can not pull
jboss-fuse-6/fis-java-openshift:2.0 image.
AFAIK, OpenShift doesn't provide fabric8.
This image is hosted in redhat container registry, not official
docker registry. In other words, this image is located at
registry.access.redhat.com/jboss-fuse-6/fis-java-openshift, not
registry-1.docker.io/v2/jboss-fuse-6/fis-java-openshift.
You need to enable docker engine to access redhat registry, please refer to this for example.
Not the way you think if you are running s2i build.
Not necessary, for either s2i build or docker build.

mvn package fabric8:build works.
<registry>registry.access.redhat.com</registry>
<authConfig>
<username>registry-username</username>
<password>registry-password</password>
</authConfig>
</configuration>

Related

Creating Springboot image with Docker took box on windows 10 using spotify maven plugin

I use docker tool box in my windows 10 home laptop. Trying to create a docker image using the springboot project I have been working on. Followed the tutorial at https://spring.io/guides/gs/spring-boot-docker/
Have been struggling with the error for past three days
Apr 03, 2019 11:52:57 AM com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://192.168.99.100:2376: Connection reset by peer: socket write error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.027 s
[INFO] Finished at: 2019-04-03T11:52:57+05:30
[INFO] Final Memory: 63M/433M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.9:build (default-cli) on project IssueTracker: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.org.apache.http.client.ClientProtocolException: Cannot retry request with a non-repeatable request entity: Connection reset by peer: socket write error -> [Help 1]
Many websites I look up said this could be something related to disabling TLS. I tried to expose the host, disable the tls but still the issue persists. Any help will be appreciated.
The following is my maven plugin config
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.9</version>
<configuration>
<repository>${docker.image.prefix}/${project.artifactId}</repository>
</configuration>
</plugin>
Did you try to run this maven goal inside "Docker Quickstart Terminal"?

Maven build works with Docker GUI running but not with the binary

I installed the Docker executable with brew install docker and I can see it in the PATH of bash:
$ which docker
/usr/local/bin/docker
I set up a Spring Boot application with this Dockerfile:
FROM openjdk:8-jre
MAINTAINER ...
COPY dist /dist/
ARG JAR_FILE
COPY target/${JAR_FILE} /target/app.jar
EXPOSE 8080
CMD ["java", "-jar", "/target/app.jar"]
When I have the Docker GUI application running, Maven builds the app and I can run it and see it locally. But when the Docker GUI application is not running, Maven is unable to build the app, even though it is in the bash executable, because it can't establish a connection to Docker:
$ mvn clean install
[INFO] Scanning for projects...
...
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
...
Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused
...
Caused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused
...
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused
...
Caused by: java.io.IOException: Connection refused
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.498 s
[INFO] Finished at: 2018-09-12T11:39:34+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.4:build (default) on project econometer: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: Connection refused -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Does Maven use a different PATH than bash? How can I give the path to the docker executable to Maven?
Docker uses a client-server architecture, and the "whale" application provides the "server" half of it. On a Mac you need to have the desktop application running (or a heavier-weight VM like what Docker Machine or minikube provides) to use any Docker commands or otherwise interact with Docker.

why maven-sonar-plugin doesnot exist?

I am facing a similar issue as in https://issues.apache.org/jira/browse/MNG-4001
but with maven-sonar-plugin. Versions i am using are:
Jenkins - 1.580.1, SonarQube-plugin in Jenkins -2.1, tried with Sonar 4.0 and SonarQube 4.5.1 but faced same error, sonar-maven-plugin: 2.6 /2.7.1 (tried both) I face this error when i use Sonar post build step in my Jenkins configuration and this is frequent issue seen in different jobs
Error is
[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
why am i facing this error ? is the issue(bug) with Sonarqube plugin in Jenkins?
for time being to avoid this error i have deleted Sonar post build step and added the sonar analysis step in maven goals for 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>
but this is a temporary solution, I would like to use Sonar post build step in my job configuration and not face this error.
Thanks for your help
SonarQube FAQ recommends the following:
If you get this error message after launching the maven command line "mvn sonar:sonar" add the "-U" parameter to the command line. Maven will then update its local repository with the latest version of the Sonar Maven plugin.
If adding the "-U" parameter doesn't fix your issue, you've certainly encountered Maven bug MNG-4001. The only known workaround is to delete the org\codehaus\mojo directory in your local Maven repository. Of course, if your local Maven repository is synchronized with a repository manager like Nexus, this operation must be also done on the repository manager side.
The problem is simply cause you are using the wrong coordinates of the plugin:
'org.apache.maven.plugins:maven-sonar-plugin'
The sonar-maven-plugin is not part of Apache Software Foundation.
You will find it here:
http://www.mojohaus.org/sonar-maven-plugin/
And how to use it here:
http://www.mojohaus.org/sonar-maven-plugin/plugin-info.html

sonar maven plugin build error, SonarQube version: null

My jenkins builds just started to fail with this message:
[INFO] --- sonar-maven-plugin:2.7:sonar (default-cli) # cividas-core-web ---
[INFO] artifact com.ontimize:ontimize-core: checking for updates from central
[INFO] artifact com.ontimize:ontimize-core: checking for updates from imatia-local
[INFO] artifact com.ontimize:ontimize-core: checking for updates from snapshots
[INFO] User cache: /var/lib/jenkins/.sonar/cache
[INFO] SonarQube version: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.773s
[INFO] Finished at: Thu Oct 22 19:49:04 CEST 2015
[INFO] Final Memory: 13M/193M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project cividas-core-web: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project cividas-core-web: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:107)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:141)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.maven.artifact.versioning.ComparableVersion.parseVersion(ComparableVersion.java:354)
at org.apache.maven.artifact.versioning.ComparableVersion.<init>(ComparableVersion.java:345)
at org.apache.maven.artifact.versioning.DefaultArtifactVersion.parseVersion(DefaultArtifactVersion.java:110)
at org.apache.maven.artifact.versioning.DefaultArtifactVersion.<init>(DefaultArtifactVersion.java:46)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.isVersionPriorTo5Dot2(RunnerBootstrapper.java:192)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:84)
... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Sonar analysis completed: FAILURE
What is this all about?
Solved by downgrading the automatically picked latest (2.7) version to an older one (2.4) by adding this code to the plugins section of my pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
For those interested in "why?", I've done some more digging and what seems to be happening is this:
RunnerBootstrapper attempts to check whether a version is 5.2+:
First, serverVersion is retrieved from a launcher created in EmbeddedRunner,
using IsolatedLauncher creating a proxy of implementation class BatchIsolatedLauncher
which attempts to read a resource file sq-version.txt containing the version.
This sq-version.txt file is located in org.codehaus.sonar:sonar-plugin-api, but this dependency is not included (even transitively) in the sonar-maven-plugin. All it references sonar-wise is org.sonarsource.sonar-runner:sonar-runner-api.
They seem to have changed the location and name of the version txt file but not updated all code. You might get away with manually adding an sq-version.txt with content 5.2 (no newline) to the plugin classpath (possibly by updating the plugin jar), or add a dependency on sonar-plugin-api, but these are hacks.
The sonar-maven-plugin 2.6 uses sonar-runner 2.4, which is very different from 2.5 that sonar-maven-plugin 2.7 uses (the groupId for sonar-runner has changed domains from org.codehaus.sonar.runner to org.sonarsource.sonar-runner), so it's best to stick to the v2.6 plugin until they have smoothed out the transition and released a few more versions.
The way SonarQube server version is passed to maven-sonar-plugin has changed in v2.7, along with other things, since it uses now sonar-runner 2.5.
There is indeed a bug when using it with SonarQube instances < 4.3, for which I opened the ticket: https://jira.sonarsource.com/browse/MSONAR-131
Note that SQs < 4.5 (current LTS) are no longer actively supported and there is no guarantee that sonar-maven-plugin won't be incompatible with them in other ways due to the new interface exposed by sonar-runner 2.5.
For these cases, it is probably best to lock the maven plugin version to 2.6, as already suggested.
We had the same problem at work today, we automatically use the latest version for maven and sonar plugins. It wasn't easy to find the problem at first.
The answer elcodedocle has given is correct, but i would like to add for those that use maven with sonar in an automated fashion that this is a solution aswell:
org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
This way it runs on the older version 2.6 and i can confirm that it works.
There is probably a bug in 2.7 and i hope it gets fixed soon. This was our error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven plugin:2.7:sonar (default-cli) on project (projectName): Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. "(projectName)" is orphan -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
EDIT:
Take a look at this post for some more information: Jenkins Sonar plugin suddenly stops working
Here is explained that the new version, 2.7, of the plugin is no longer compatible with java 6 projects. You can also find an explanation about how to fix it in Jenkins if you are not familiar with it. (my explanation was a bit short)
This is a hint:
[INFO] SonarQube version: null
Later in the code, Maven tries to parse this version number and fails. The source code is here: https://github.com/mojohaus/sonar-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/sonar/bootstrap/RunnerBootstrapper.java
From the source of the SonarQube runner, this is backed by a properties instance. So maybe the code couldn't access the server or the server isn't sending this data back. Hard to tell.
What I can see is that the code changed in 2.5. That's probably why 2.4 still works. See here how to nail down the versions: Jenkins Sonar plugin suddenly stops working
Discover the appropriate plugin version for you running sonar installation.
E.g.
mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
This plugin version will not work against the latest sonar release but will work fine against a 4.1.2.

WARNING] Unable to get resource 'org.codehaus.sonar:sonar-maven-plugin:pom:4.0'

I am trying to run maven build with sonar on Ubuntu 10.04 version..but am getting below error. Can someone help me here what configuration I need to make..
Error is here:-
[INFO] Sonar version: 4.0
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:4.0:sonar
Downloading: http://repo1.maven.org/maven2/org/codehaus/sonar/sonar-maven-plugin/4.0/sonar-maven-plugin-4.0.pom
[WARNING] Unable to get resource 'org.codehaus.sonar:sonar-maven-plugin:pom:4.0' from repository central (: Error transferring file: Connection timed out
Downloading: http://repo1.maven.org/maven2/org/codehaus/sonar/sonar-maven-plugin/4.0/sonar-maven-

Resources