You are viewing a plain text version of this content. The canonical link for it is here.
Posted to builds@apache.org by lewis john mcgibbney <le...@gmail.com> on 2011/09/27 16:37:32 UTC

Sonar Plugin for Nutch Jenkins CI nightly build.

Hi builds@,

I wonder if anyone can provide some direction regarding how I can get the
above plugin to work as a post-build task for our Nutch trunk build [1]. I
opened an issue in our Jira for the functionality and would like to commit
the following (or something similar) patch to our ant build script. One
problem I for see is the classpath path, however I am not sure what to set
this to as I have not configured the plugin before.

+  <!-- ==================================================================
-->
+  <!-- SONAR targets
-->
+  <!-- ==================================================================
-->
+
+  <!-- Define the Sonar task if this hasn't been done in a common script
-->
+  <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
+    <classpath path="../sonar-ant-task-1.1.jar" />
+  </taskdef>
+
+  <!-- Add the target -->
+  <target name="sonar">
+    <!-- list of mandatories Sonar properties -->
+    <property name="sonar.sources" value="${src.dir}" />
+
+    <!-- list of optional Sonar properties -->
+    <property name="sonar.projectName" value="Nutch.Sonar.Analysis" />
+    <property name="sonar.tests" value="${test.src.dir}" />
+
+    <sonar:sonar key="org.example:example" version="0.1-SNAPSHOT"
xmlns:sonar="antlib:org.sonar.ant"/>
+  </target>

I'm aware that it is best to use an enterprise relational database but I
think for the purpose of this experiment the default Derby db will suffice.
I wonder if anyone has experience using this plugin and how the
configuration options above need to be edited to allow us to do some Sonar
analysis on the Nutch codebase.

Thanks in advance for any pointers.

[1] https://builds.apache.org/view/M-R/view/Nutch/job/Nutch-trunk/
-- 
*Lewis*

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by lewis john mcgibbney <le...@gmail.com>.
Hi,

I've attached my final patch to the Nutch Jira issue [1] I opened a while
back. I paste the code below and wonder if you can quickly give it a once
over before I commit. This is my first time using Sonar and I lack the
experience to pull this one off on my own. If you were able to provide
comments it would be greatly appreciated. In addition I've opened a Infra
Jira ticket here [2] as advised, thanks for this.

+  <!-- ==================================================================
-->
+  <!-- SONAR targets
-->
+  <!-- ==================================================================
-->
+
+  <!-- Define the Sonar task if this hasn't been done in a common script
-->
+  <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
+    <classpath path="../sonar-ant-task-1.1.jar" />
+  </taskdef>
+
+  <!-- Add the target -->
+  <target name="sonar">
+    <sonar:sonar workDir="${build.dir}" key="org.apache.nutch:nutch"
version="Nutch Branch-1.4" xmlns:sonar="antlib:org.sonar.ant"/>
+
+    <!-- source directories (required) -->
+    <sources>
+      <path location="${src.dir}" />
+    </sources>
+
+    <!-- list of properties (optional) -->
+    <property key="sonar.projectName" value="Nutch Branch-1.4 Sonar
Analysis" />
+    <property key="sonar.dynamicAnalysis" value="false" />
+
+    <!-- test source directories (optional) -->
+    <tests>
+      <path location="${test.src.dir}" />
+    </tests>
+
+    <!-- binaries directories, which contain for example the compiled Java
bytecode -->
+     <binaries>
+       <path location="${build.dir}/classes"/>
+     </binaries>
+  </target>

[1] https://issues.apache.org/jira/browse/NUTCH-1109
[2] https://issues.apache.org/jira/browse/INFRA-3965

On Tue, Sep 27, 2011 at 8:17 PM, Olivier Lamy <ol...@apache.org> wrote:

> A Jira is always good for follow up as we have various tz etc....
>
> Can you have a look at [1] and add some targets in your build file
> (you can probably test sonar with a local instance)
> When it's done I will be able to setup a Jenkins jobs and pass needed
> properties (-Dsonar.jdbc.username= etc...).
>
> --
> Olivier Lamy
>

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by Olivier Lamy <ol...@apache.org>.
A Jira is always good for follow up as we have various tz etc....

Can you have a look at [1] and add some targets in your build file
(you can probably test sonar with a local instance)
When it's done I will be able to setup a Jenkins jobs and pass needed
properties (-Dsonar.jdbc.username= etc...).

-- 
Olivier Lamy
Talend : http://talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

[1] http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task+1.0

2011/9/27 lewis john mcgibbney <le...@gmail.com>:
> Hi Oliver,
>
> Is it necessary for me to log a job with infra jira?
>
> Thank you
>
> On Tue, Sep 27, 2011 at 4:44 PM, Olivier Lamy <ol...@apache.org> wrote:
>
>> Hello,
>> See here [1] and I will take care of that. Usually it's easy if you
>> have a maven build.
>>
>> --
>> Olivier Lamy
>> Talend : http://talend.com
>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>
>> [1] http://wiki.apache.org/general/SonarInstance
>>
>> 2011/9/27 lewis john mcgibbney <le...@gmail.com>:
>> > This is exactly what I am looking for, I was aware that there are a
>> number
>> > of Apache projects being analysed by Sonar.
>> >
>> > Do you have information as to how I can get our trunk codebase analysed
>> and
>> > the analysis hosted at the link you provided?
>> >
>> > Thanks Niklas
>> >
>> > On Tue, Sep 27, 2011 at 4:32 PM, Niklas Gustavsson <niklas@protocol7.com
>> >wrote:
>> >
>> >> On Tue, Sep 27, 2011 at 4:37 PM, lewis john mcgibbney
>> >> <le...@gmail.com> wrote:
>> >> > I wonder if anyone has experience using this plugin and how the
>> >> > configuration options above need to be edited to allow us to do some
>> >> Sonar
>> >> > analysis on the Nutch codebase.
>> >>
>> >> There is a Sonar installation at ASF for this purpose, would that work
>> for
>> >> you?
>> >>
>> >> https://analysis.apache.org/
>> >>
>> >> /niklas
>> >>
>> >
>> >
>> >
>> > --
>> > *Lewis*
>> >
>>
>
>
>
> --
> *Lewis*
>

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by lewis john mcgibbney <le...@gmail.com>.
Hi Oliver,

Is it necessary for me to log a job with infra jira?

Thank you

On Tue, Sep 27, 2011 at 4:44 PM, Olivier Lamy <ol...@apache.org> wrote:

> Hello,
> See here [1] and I will take care of that. Usually it's easy if you
> have a maven build.
>
> --
> Olivier Lamy
> Talend : http://talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> [1] http://wiki.apache.org/general/SonarInstance
>
> 2011/9/27 lewis john mcgibbney <le...@gmail.com>:
> > This is exactly what I am looking for, I was aware that there are a
> number
> > of Apache projects being analysed by Sonar.
> >
> > Do you have information as to how I can get our trunk codebase analysed
> and
> > the analysis hosted at the link you provided?
> >
> > Thanks Niklas
> >
> > On Tue, Sep 27, 2011 at 4:32 PM, Niklas Gustavsson <niklas@protocol7.com
> >wrote:
> >
> >> On Tue, Sep 27, 2011 at 4:37 PM, lewis john mcgibbney
> >> <le...@gmail.com> wrote:
> >> > I wonder if anyone has experience using this plugin and how the
> >> > configuration options above need to be edited to allow us to do some
> >> Sonar
> >> > analysis on the Nutch codebase.
> >>
> >> There is a Sonar installation at ASF for this purpose, would that work
> for
> >> you?
> >>
> >> https://analysis.apache.org/
> >>
> >> /niklas
> >>
> >
> >
> >
> > --
> > *Lewis*
> >
>



-- 
*Lewis*

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by lewis john mcgibbney <le...@gmail.com>.
Hi Oliver,

Thanks for the resource, although we currently build with Ant. I have a
reasonable idea of what difference this makes to the configuration for the
Sonar job, however there are grey areas where I am pretty unsure. I assume
that it requires me to have an ant target in my build.xml?

I am happy to update the general wiki with the details once this is sorted.

Thanks

On Tue, Sep 27, 2011 at 4:44 PM, Olivier Lamy <ol...@apache.org> wrote:

> Hello,
> See here [1] and I will take care of that. Usually it's easy if you
> have a maven build.
>
> --
> Olivier Lamy
> Talend : http://talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> [1] http://wiki.apache.org/general/SonarInstance
>
> 2011/9/27 lewis john mcgibbney <le...@gmail.com>:
> > This is exactly what I am looking for, I was aware that there are a
> number
> > of Apache projects being analysed by Sonar.
> >
> > Do you have information as to how I can get our trunk codebase analysed
> and
> > the analysis hosted at the link you provided?
> >
> > Thanks Niklas
> >
> > On Tue, Sep 27, 2011 at 4:32 PM, Niklas Gustavsson <niklas@protocol7.com
> >wrote:
> >
> >> On Tue, Sep 27, 2011 at 4:37 PM, lewis john mcgibbney
> >> <le...@gmail.com> wrote:
> >> > I wonder if anyone has experience using this plugin and how the
> >> > configuration options above need to be edited to allow us to do some
> >> Sonar
> >> > analysis on the Nutch codebase.
> >>
> >> There is a Sonar installation at ASF for this purpose, would that work
> for
> >> you?
> >>
> >> https://analysis.apache.org/
> >>
> >> /niklas
> >>
> >
> >
> >
> > --
> > *Lewis*
> >
>



-- 
*Lewis*

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by Olivier Lamy <ol...@apache.org>.
Hello,
See here [1] and I will take care of that. Usually it's easy if you
have a maven build.

-- 
Olivier Lamy
Talend : http://talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

[1] http://wiki.apache.org/general/SonarInstance

2011/9/27 lewis john mcgibbney <le...@gmail.com>:
> This is exactly what I am looking for, I was aware that there are a number
> of Apache projects being analysed by Sonar.
>
> Do you have information as to how I can get our trunk codebase analysed and
> the analysis hosted at the link you provided?
>
> Thanks Niklas
>
> On Tue, Sep 27, 2011 at 4:32 PM, Niklas Gustavsson <ni...@protocol7.com>wrote:
>
>> On Tue, Sep 27, 2011 at 4:37 PM, lewis john mcgibbney
>> <le...@gmail.com> wrote:
>> > I wonder if anyone has experience using this plugin and how the
>> > configuration options above need to be edited to allow us to do some
>> Sonar
>> > analysis on the Nutch codebase.
>>
>> There is a Sonar installation at ASF for this purpose, would that work for
>> you?
>>
>> https://analysis.apache.org/
>>
>> /niklas
>>
>
>
>
> --
> *Lewis*
>

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by lewis john mcgibbney <le...@gmail.com>.
This is exactly what I am looking for, I was aware that there are a number
of Apache projects being analysed by Sonar.

Do you have information as to how I can get our trunk codebase analysed and
the analysis hosted at the link you provided?

Thanks Niklas

On Tue, Sep 27, 2011 at 4:32 PM, Niklas Gustavsson <ni...@protocol7.com>wrote:

> On Tue, Sep 27, 2011 at 4:37 PM, lewis john mcgibbney
> <le...@gmail.com> wrote:
> > I wonder if anyone has experience using this plugin and how the
> > configuration options above need to be edited to allow us to do some
> Sonar
> > analysis on the Nutch codebase.
>
> There is a Sonar installation at ASF for this purpose, would that work for
> you?
>
> https://analysis.apache.org/
>
> /niklas
>



-- 
*Lewis*

Re: Sonar Plugin for Nutch Jenkins CI nightly build.

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Tue, Sep 27, 2011 at 4:37 PM, lewis john mcgibbney
<le...@gmail.com> wrote:
> I wonder if anyone has experience using this plugin and how the
> configuration options above need to be edited to allow us to do some Sonar
> analysis on the Nutch codebase.

There is a Sonar installation at ASF for this purpose, would that work for you?

https://analysis.apache.org/

/niklas