Here is a simple way to do that : 1 - You can set any property directly into the Maven command line : mvn sonar:sonar -DsrcDirectory=/vol/myProject/src -DbinDirectory=...
2- You can retrieve those values into your pom.xml file : <sourceDirectory>${srcDirectory}</sourceDirectory> <outputDirectory>${binDirectory}</outputDirectory> regards, ---------------------------------------- Freddy Mallet www.SonarSource.com Sonar.codehaus.org http://twitter.com/FreddyMallet ---------------------------------------- On Sat, Mar 13, 2010 at 3:14 PM, swaroopgr <swaro...@netapp.com> wrote: > > Ah! No I can't. That's our default build env! I can't decide! :) > > Any other ideas to get this working? > > > > Maven User-2 wrote: > > > > Pull the trigger - modularize and move completely to maven 2. > > > > On Mar 12, 2010, at 8:05 PM, swaroopgr <swaro...@netapp.com> wrote: > > > >> > >> Here's why: > >> > >> I'm setting up sonar - a tool for code quality analysis. The way > >> sonar is > >> run is: > >> > >> "mvn sonar:sonar" > >> > >> I'm using ANT to build my project. However, sonar requires a dummy > >> pom.xml > >> file to trick it into saying it's a maven project. Then, Sonar will > >> go and > >> descend into all the directories and complete static code analysis. > >> > >> In my case, I need only specific directories to be analysed by > >> Sonar. Hence, > >> I simply list these directories and feed it into the pom.xml file's > >> <sourceDirectory> property. This will allow sonar to analyse only > >> those > >> modules. > >> > >> Hence, I somehow need to figure out how I can feed these files one > >> by one > >> into pom.xml and call mvn each time. > >> > >> > >> > >> > >> > >> Baptiste MATHUS wrote: > >>> > >>> Hi, > >>> > >>> First question: why do you need to do this? > >>> > >>> Maven defines strong conventions principles over config. So doing > >>> what you > >>> say seems quite uncommon. So you've got three solutions: > >>> * if the project can be cleanly refactored to be built, with clear > >>> deps > >>> and > >>> so on => the way to go > >>> * if those source directories comes from a special process (say > >>> generation), > >>> then maybe the way to go is more writing a maven plugin that will > >>> do what > >>> you need cleanly (writing a maven plugin is very simple). To help > >>> answer > >>> this question, I guess you'll have to explain your need a bit more. > >>> * combine ant-run plugin/buildhelper should help do the trick, but > >>> this > >>> would be like using ant to compile when developing under eclipse > >>> > >>> Cheers > >>> > >>> 2010/3/12 swaroopgr <swaro...@netapp.com> > >>> > >>>> > >>>> I'm need to use custom variables in maven. Here's what I do: > >>>> > >>>> Run the "ls" command in the current directory. For each directory > >>>> listed, > >>>> I > >>>> want to add the name in pom.xml's <sourceDirectory> $DirectoryName > >>>> </sourceDirectory>property and run mvn. If there's a way to set > >>>> name / > >>>> value > >>>> pairs during mvn invocation, that would be best. If not, what's > >>>> the best > >>>> way > >>>> to do this? > >>>> -- > >>>> View this message in context: > >>>> > http://old.nabble.com/Setting-custom-varaibles-tp27881131p27881131.html > >>>> Sent from the Maven - Users mailing list archive at Nabble.com. > >>>> > >>>> > >>>> --- > >>>> ------------------------------------------------------------------ > >>>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > >>>> For additional commands, e-mail: users-h...@maven.apache.org > >>>> > >>>> > >>> > >>> > >>> -- > >>> Baptiste <Batmat> MATHUS - http://batmat.net > >>> Sauvez un arbre, > >>> Mangez un castor ! > >>> > >>> > >> > >> -- > >> View this message in context: > >> http://old.nabble.com/Setting-custom-varaibles-tp27881131p27884743.html > >> Sent from the Maven - Users mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > >> For additional commands, e-mail: users-h...@maven.apache.org > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > > > > -- > View this message in context: > http://old.nabble.com/Setting-custom-varaibles-tp27881131p27887572.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >