Quantcast

Problem with ant task, properties, and multi-module project

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with ant task, properties, and multi-module project

cdwillie76
I am trying to follow the example on the http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task page for processing a multi-module project.  The problem I am running in to is that my root build.xml is setting a non-sonar property that my child build.xml files need and that value isn't being set/passed down by the sonar any task so the sonar ant task fails.

Is there a way to force a property from root build.xml to the build.xml's that are defined in the sonar.modules property?

Thanks
Chris
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

Evgeny Mandrikov
Hi,

Without having a minimalistic example for Ant really hard to understand what doesn't work and what you try to achieve. So could you please provide an example project?

On Tue, Dec 20, 2011 at 15:20, cdwillie76 <[hidden email]> wrote:

I am trying to follow the example on the
http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task page for
processing a multi-module project.  The problem I am running in to is that
my root build.xml is setting a non-sonar property that my child build.xml
files need and that value isn't being set/passed down by the sonar any task
so the sonar ant task fails.

Is there a way to force a property from root build.xml to the build.xml's
that are defined in the sonar.modules property?

Thanks
Chris
--
View this message in context: http://old.nabble.com/Problem-with-ant-task%2C-properties%2C-and-multi-module-project-tp33008848p33008848.html
Sent from the Sonar user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

cdwillie76
Here is a minimal ant project that I am getting the error with.  

build-root.xml

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="runSonar">
   
   <include file="sonar/sonar-config.xml" as="sonar" optional="true"/>

   <property name="standard_build" location="standard_build.xml"/>

   <property name="sonar.modules" value="test/build.xml"/>
   <property name="sonar.projectName" value="TEST"/>

   <target name="runSonar" depends="sonar.validateSonarEnvironment" xmlns:sonar="antlib:org.sonar.ant">
     <sonar:sonar key="TEST:TEST" version="LATEST"/>
   </target>
</project>

test/build.xml

<project basedir="." default="jar">
   <import file="${standard_build}"/>

   <property name="sonar.projectKey" value="TEST:MOD_1"/>
   <property name="sonar.sources" value="src"/>
</project>

Error message
runSonar:
[sonar:sonar] Apache Ant version 1.8.1 compiled on April 30 2010
[sonar:sonar] Sonar Ant Task version: 1.2
[sonar:sonar] Loaded from: file:./apache-ant-1.8.1/lib/sonar-ant-task-1.2.jar
[sonar:sonar] Sonar work directory: ./.sonar
[sonar:sonar] Sonar server: http://server:3003
[sonar:sonar] Sonar version: 2.12

BUILD FAILED
XXXXX/build-root.xml:12: XXXXX/test/build.xml:3: Cannot find XXXXX/test/${standard_build} imported from XXXXXX/JSRC/test/build.xml

When I do a ant -d, I see that ${standard_build} is being set but for some reason it isn't passed to the sonar ant task.

The XXXX are the same full paths but had to remove for work reasons...
Thanks
Chris







Evgeny Mandrikov wrote
Hi,

Without having a minimalistic example for Ant really hard to understand
what doesn't work and what you try to achieve. So could you please provide
an example project?

On Tue, Dec 20, 2011 at 15:20, cdwillie76 <chris.d.williams@gmail.com>wrote:

>
> I am trying to follow the example on the
> http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task page for
> processing a multi-module project.  The problem I am running in to is that
> my root build.xml is setting a non-sonar property that my child build.xml
> files need and that value isn't being set/passed down by the sonar any task
> so the sonar ant task fails.
>
> Is there a way to force a property from root build.xml to the build.xml's
> that are defined in the sonar.modules property?
>
> Thanks
> Chris
> --
> View this message in context:
> http://old.nabble.com/Problem-with-ant-task%2C-properties%2C-and-multi-module-project-tp33008848p33008848.html
> Sent from the Sonar user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi all,

we're having a similar problem. We already have a complete buildsetup for a fairly complex project (>5000 classes). This buildsetup uses quite a few properties to define where to find sources, libraries etc.

So in the dependent module buildscripts I tried the following:

    ...
    <property name="build.component" value="oe" />
    ...
    <dirset id="sonar.source.dirset" dir="${build.single.basedir}/${versiontobuildwithprefix}_plugins/plugins">
      <include name="${build.component}.*/src" />
    </dirset>
    <pathconvert pathsep="," property="sonar.sources" refid="sonar.source.dirset" />
    ...

The other properties besides build.component are available in the masterbuildfile, but are not available in the module buildfiles. Since the last post in this thread was last December, I'd like to ask, whether there's work being done on this ?

As a side issue, sonar (or the sonar ant task) forces a setup like the one described in the ant task documentation, i.e. it seems to derive the source dirctory by taking the path of the module buildfile and appending the entries in soanr.sources. At least in out case, this breaks the build. It would be WAY better, if the entries in sonar.sources were taken verbatim, but I could build a workaroud here ...

Both issues together lead to our builds failing with this error:

    ...
    /ccbuild/mb2/antscripts/compile.sonar.bs.xml:13: /ccbuild/mb2/antscripts/${build.single.basedir}/${versiontobuildwithprefix}_plugins/plugins not found.
    ...

as ${build.single.basedir}/${versiontobuildwithprefix}_plugins/plugins would resolve to a fully qualified path.

Cheers
Max
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

Freddy Mallet
Hi Max, could you provide a little executable sample to quickly help us reproduce the issue locally ?

Thanks
-----
Sonar for Continuous Inspection



On Thu, Jul 26, 2012 at 3:56 PM, MaxBernhardt <[hidden email]> wrote:
Hi all,

we're having a similar problem. We already have a complete buildsetup for a
fairly complex project (>5000 classes). This buildsetup uses quite a few
properties to define where to find sources, libraries etc.

So in the dependent module buildscripts I tried the following:

    ...
    <property name="build.component" value="oe" />
    ...
    <dirset id="sonar.source.dirset"
dir="${build.single.basedir}/${versiontobuildwithprefix}_plugins/plugins">
      <include name="${build.component}.*/src" />
    </dirset>
    <pathconvert pathsep="," property="sonar.sources"
refid="sonar.source.dirset" />
    ...

The other properties besides build.component are available in the
masterbuildfile, but are not available in the module buildfiles. Since the
last post in this thread was last December, I'd like to ask, whether there's
work being done on this ?

As a side issue, sonar (or the sonar ant task) forces a setup like the one
described in the ant task documentation, i.e. it seems to derive the source
dirctory by taking the path of the module buildfile and appending the
entries in soanr.sources. At least in out case, this breaks the build. It
would be WAY better, if the entries in sonar.sources were taken verbatim,
but I could build a workaroud here ...

Both issues together lead to our builds failing with this error:

    ...
    /ccbuild/mb2/antscripts/compile.sonar.bs.xml:13:
/ccbuild/mb2/antscripts/${build.single.basedir}/${versiontobuildwithprefix}_plugins/plugins
not found.
    ...

as ${build.single.basedir}/${versiontobuildwithprefix}_plugins/plugins would
resolve to a fully qualified path.

Cheers
Max




--
View this message in context: http://sonar.15.n6.nabble.com/Problem-with-ant-task-properties-and-multi-module-project-tp3197913p5001370.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi Freddie,

thanks for the answer. I've cobbled together a very compact version of what happens here.
sonar-ex.tgz

Just extract the tgz, switch to the directory sonar-ex and run ant.

Cheers
Max
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi Freddy,

sorry for the misspelling ... the day was too long.

Cheers
Max
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt

 

Hi again,

 

now hopefully with nonbroken attachment. 

 

Cheers 

Max 


MaxBernhardt <[hidden email]> hat am 27. Juli 2012 um 19:48 geschrieben:

> Hi Freddy,
>
> sorry for the misspelling ... the day was too long.
>
> Cheers
> Max
>
>
>
> --
> View this message in context: http://sonar.15.n6.nabble.com/Problem-with-ant-task-properties-and-multi-module-project-tp3197913p5001446.html
> Sent from the Sonar user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

sonar-ex.tgz (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi,

did the example help ? Did you have time to check the issue ?

Cheers
Max
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

David Racodon-2
Hi Max,

The other properties besides build.component are available in the
masterbuildfile, but are not available in the module buildfiles.

We'll wait until we reproduce the other issue you have regarding the Ant task and FindBugs.
Then we'll make a decision on how to deal with those issues on the Sonar Ant Task and keep you posted.


As a side issue, sonar (or the sonar ant task) forces a setup like the one
described in the ant task documentation, i.e. it seems to derive the source
dirctory by taking the path of the module buildfile and appending the
entries in soanr.sources. At least in out case, this breaks the build. It
would be WAY better, if the entries in sonar.sources were taken verbatim,
but I could build a workaroud here ...

Just to make sure: you'd like to be able to enter either absolute or relative path, right?


Regards,

David RACODON | SonarSource
Senior Consultant



On 3 August 2012 10:57, MaxBernhardt <[hidden email]> wrote:
Hi,

did the example help ? Did you have time to check the issue ?

Cheers
Max



--
View this message in context: http://sonar.15.n6.nabble.com/Problem-with-ant-task-properties-and-multi-module-project-tp3197913p5001602.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi David,

thanks for the work in reproducing the issue.

David Racodon-2 wrote
> As a side issue, sonar (or the sonar ant task) forces a setup like the one
> described in the ant task documentation, i.e. it seems to derive the source
> dirctory by taking the path of the module buildfile and appending the
> entries in soanr.sources. At least in out case, this breaks the build. It
> would be WAY better, if the entries in sonar.sources were taken verbatim,
> but I could build a workaroud here ...

Just to make sure: you'd like to be able to enter either absolute or
relative path, right?
Due to the fact, that we use ant dirsets to build the sonar.sources property, we use absolute paths. So I'd like absolute paths to work. If you think that using relative instead of absolute paths would solve the issue, I'd give it a try, using a mapper similar to the one I used for the sonar.modules.

Cheers
Max

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

David Racodon-2
Hi Max,

Yep, give a try with relative paths.

Regards,

David RACODON | SonarSource
Senior Consultant



On 9 August 2012 18:18, MaxBernhardt <[hidden email]> wrote:
Hi David,

thanks for the work in reproducing the issue.


David Racodon-2 wrote
>
>> As a side issue, sonar (or the sonar ant task) forces a setup like the
>> one
>> described in the ant task documentation, i.e. it seems to derive the
>> source
>> dirctory by taking the path of the module buildfile and appending the
>> entries in soanr.sources. At least in out case, this breaks the build. It
>> would be WAY better, if the entries in sonar.sources were taken verbatim,
>> but I could build a workaroud here ...
>
> Just to make sure: you'd like to be able to enter either absolute or
> relative path, right?
>

Due to the fact, that we use ant dirsets to build the sonar.sources
property, we use absolute paths. So I'd like absolute paths to work. If you
think that using relative instead of absolute paths would solve the issue,
I'd give it a try, using a mapper similar to the one I used for the
sonar.modules.

Cheers
Max





--
View this message in context: http://sonar.15.n6.nabble.com/Problem-with-ant-task-properties-and-multi-module-project-tp3197913p5001847.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi David,

in the meantime I've upgraded to ant-task 1.4

If I make sure (by setting it again manually), that the basepath of the dirset, that is used to create the sonar.sources property is known, then the second problem is either fixed with 1.4 or maybe was never there. It looks to me now, that the prepended base directory of the ant build script comes from the fact, that the property didn't get passed to the childscript and the ant task gave it its best to find the directories from sonar.sources.

The problem of the manipulation of the sonar.sources is gone, once I have a way of passing down properties from the master buildscript to the childscripts.

Cheers
Max
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

David Racodon-2
Hi Max,

I raised a JIRA ticket against this issue: http://jira.codehaus.org/browse/SONARPLUGINS-2156.

Regards,

David RACODON | SonarSource
Senior Consultant



On 13 August 2012 20:02, MaxBernhardt <[hidden email]> wrote:
Hi David,

in the meantime I've upgraded to ant-task 1.4

If I make sure (by setting it again manually), that the basepath of the
dirset, that is used to create the sonar.sources property is known, then the
second problem is either fixed with 1.4 or maybe was never there. It looks
to me now, that the prepended base directory of the ant build script comes
from the fact, that the property didn't get passed to the childscript and
the ant task gave it its best to find the directories from sonar.sources.

The problem of the manipulation of the sonar.sources is gone, once I have a
way of passing down properties from the master buildscript to the
childscripts.

Cheers
Max



--
View this message in context: http://sonar.15.n6.nabble.com/Problem-with-ant-task-properties-and-multi-module-project-tp3197913p5001927.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with ant task, properties, and multi-module project

MaxBernhardt
Hi David,

thanks for the info.

Cheers
Max
Loading...