Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven task does not find SonarQube report metadata and fails build #2485

Closed
swansonaj opened this issue Sep 11, 2016 · 13 comments
Closed

Maven task does not find SonarQube report metadata and fails build #2485

swansonaj opened this issue Sep 11, 2016 · 13 comments
Assignees

Comments

@swansonaj
Copy link

Java web app build consistently failing when SonarQube analysis is enabled. When running the build in debug I think I found the problem. Maven is writing the SonarQube report-task.txt file to one location while the VSTS maven task is looking for it in another. The difference is that Maven is including the name of my web project in the path while the VSTS maven task is not. See the bolded lines below for an example:

2016-09-11T02:53:13.6724561Z [DEBUG] Report metadata written to C:\agent_work\1\s\JRA-CHARTING\target\sonar\report-task.txt
2016-09-11T02:53:13.6724561Z [DEBUG] Post-jobs :
2016-09-11T02:53:13.6724561Z [DEBUG] Execution getVersion
2016-09-11T02:53:13.6724561Z [DEBUG] Execution stop
2016-09-11T02:53:13.7505657Z [INFO] ------------------------------------------------------------------------
2016-09-11T02:53:13.7505657Z [INFO] BUILD SUCCESS
2016-09-11T02:53:13.7505657Z [INFO] ------------------------------------------------------------------------
2016-09-11T02:53:13.7505657Z [INFO] Total time: 14.750 s
2016-09-11T02:53:13.7505657Z [INFO] Finished at: 2016-09-10T21:53:13-05:00
2016-09-11T02:53:13.9224543Z [INFO] Final Memory: 34M/749M
2016-09-11T02:53:13.9224543Z [INFO] ------------------------------------------------------------------------
2016-09-11T02:53:14.2036927Z ##[debug]rc:0
2016-09-11T02:53:14.2036927Z ##[debug]success:true
2016-09-11T02:53:14.2036927Z ##[debug]sqAnalysisEnabled=true
2016-09-11T02:53:14.2036927Z ##[debug]build.sourcesDirectory=C:\agent_work\1\s
2016-09-11T02:53:14.2036927Z ##[debug]build.sourceBranch=refs/heads/master
2016-09-11T02:53:14.2036927Z ##[debug]build.repository.provider=TfsGit
2016-09-11T02:53:14.2036927Z ##[debug]Source Branch: refs/heads/master
2016-09-11T02:53:14.2036927Z ##[debug]Scc Provider: TfsGit
2016-09-11T02:53:14.2036927Z ##[debug]Task report not found at: C:\agent_work\1\s\target\sonar\report-task.txt
2016-09-11T02:53:14.2036927Z Invalid or missing task report. Check SonarQube finished successfully.
2016-09-11T02:53:14.2036927Z Code analysis failed.
2016-09-11T02:53:14.2036927Z ##[debug]task result: Failed
2016-09-11T02:53:14.2036927Z ##[debug]Processing: ##vso[task.issue type=error;]Build failed.
2016-09-11T02:53:14.2193226Z ##[error]Build failed.
2016-09-11T02:53:14.2193226Z ##[debug]Processing: ##vso[task.complete result=Failed;]Build failed.
2016-09-11T02:53:14.2193226Z ##[section]Finishing: Maven JRA-CHARTING/pom.xml

@HSAR
Copy link
Contributor

HSAR commented Sep 12, 2016

Hi swansonaj,

Thanks for reporting this bug. I have taken a look at the code and it looks like we are currently always looking for the report-task.txt file in ~/target/sonar directory, exactly as you have described. However, our default integration applies the SonarQube goals at the top level and so that we exactly where we expect it to be created. Have you customised the SonarQube plugin settings in the pom.xml and if so can you upload a copy so we can attempt to repro the problem?

In the meantime you can still apply the "sonar:sonar" goal and related arguments to effect the SonarQube analysis of your build, though features such as the build breaker and build summaries will not be available.

~ Sam

@swansonaj
Copy link
Author

Sam -

I have not included the SonarQube plug-in in my pom.xml -- I am enabling it through the VSTS Maven task, This build was working fine up until a few days ago (Sep 10 to be exact). Regaredless, I am attaching the pom for your review as well as logs for the build. I think the root of the problem is that I am not loading my pom from the root of the Git repo but rather from a path, i.e. JRA-CHARTING/pom.xml so the SonarQube plug-in (injected by VSTS) is treating "JRA-CHARTING/" as the top level of the build. As I mentioned, this was working up until a few days ago so something regressed.

pom and logs.zip

Thanks,
Andrew

@HSAR
Copy link
Contributor

HSAR commented Sep 12, 2016

Hi Andrew,

Thanks for getting back to me. I'll take a look at your information and files and see if I can get a repro. The information about loading pom.xml from a non-root location sounds promising.

I'm also looking into your report that this is a recent failure, but I'm not sure why that is at this time.

~ Sam

@HSAR
Copy link
Contributor

HSAR commented Sep 13, 2016

Hi Andrew,

I have secured a repro and we are working on a fix to be included in a future release. Thanks again for reporting this issue.

~ Sam

@swansonaj
Copy link
Author

Sam -

That is indeed good news. So, I have to ask, do you have any idea when
this future release will happen?

Thanks,
Andrew

On Tue, Sep 13, 2016 at 5:17 AM, Shu Sam Chen notifications@github.com
wrote:

Hi Andrew,

I have secured a repro and we are working on a fix to be included in a
future release. Thanks again for reporting this issue.

~ Sam


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2485 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AVGbje05x66WwkBzXku22fNO7A8cK5Uvks5qpnhLgaJpZM4J55CZ
.

@billpieper
Copy link

+1 on wondering when the fix will be released for this. I believe we are experiencing the same issue after the most recent maven task update.

@HSAR
Copy link
Contributor

HSAR commented Sep 15, 2016

Hi Andrew and Bill,

We don't know at this time when a fix will be. In the meantime, the integration code is fully functional if the pom.xml file is at the root of the project, or you can use the sonar:sonar goal as a manually-added Maven step.

We'll update this thread when we have more information.

~ Sam

@bgavrilMS
Copy link
Member

Hi Andrew and Bill. I have a fix for this and we're looking at getting it with the next deployment train, which should finish in less than 2 weeks.

@HughAJWood
Copy link

Hi we have also ran into this issue today. @bgavrilMS will the fix work with the following repo layout:

The repo: https://github.com/rencoreab/sharepoint-sonarqube

ie.
root
-project\pom.xml
-project\pom.xml
-project\pom.xml
-project\pom.xml
-project\pom.xml

@bgavrilMS
Copy link
Member

How do you build this project? Do you have a single build definition with multiple Maven steps or do you have several definitions?

@HughAJWood
Copy link

One build definition with multiple steps, one for each pom file

@bgavrilMS
Copy link
Member

The Maven task does some post-processing in that it tries to locate unit test results, code coverage, standalone code analysis files and some SonarQube files. Since you're invoking the build task several times, we may not pick up those artifacts correctly (we search for them in the build directory).

The pattern we've seen used here is multi-module Maven, i.e. have a top level pom file that references each project as a module. All the tools work fine with multi-module Maven.

@HughAJWood
Copy link

@bgavrilMS I will see what I can do with this project, thanks for the support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants