atom feed4 messages in org.codehaus.sonar.userRe: [sonar-user] Problem in creating ...
FromSent OnAttachments
AlpeshMar 17, 2009 12:01 am 
Olivier GaudinMar 17, 2009 1:40 pm 
AlpeshMar 18, 2009 12:45 am 
Freddy MalletMar 19, 2009 7:23 am 
Subject:Re: [sonar-user] Problem in creating profile - Importing PMD file
From:Freddy Mallet (fred@gmail.com)
Date:Mar 19, 2009 7:23:47 am
List:org.codehaus.sonar.user

Hi Alpesh,

After few changes, I've managed to import your PMD configuration file. The key point is that you can't currently define and use a PMD rule in the same file. Here are the differents steps :

1- Create a AtosOriginiRuleSet.xml file which contains the definition of your new XPath PMD rule :

<ruleset name="Atos PMD ruleset"> <rule name="AtosOriginPackageName" message="Toute classe d'un projet doit appartenir a un package ( com.atosorigin par exemple)." class="net.sourceforge.pmd.rules.XPathRule"> <description> Toute classe d'un projet doit appartenir a un package ( com.atosorigin. ...) </description> <properties> <property name="xpath"> <value> //PackageDeclaration/Name[not (starts-with(@Image,'com.atosorigin') )] </value> </property> </properties> <priority>3</priority> </rule> </ruleset>

2- Package this file in a jar and place this jar in extensions/rules/pmd directory 3- Create a pmd-sonar.xml and place this file in the extensions/rules/pmd directory

<rules> <rule key="AtosOriginPackageName"> <name>Toute classe d'un projet doit appartenir a un package ( com.atosorigin. ...)</name>

<configKey>AtosOriginRuleSet.xml/AtosOriginPackageName</configKey>

<category name="Reliability"/> <description><![CDATA[Toute classe d'un projet doit appartenir a un package ( com.atosorigin. ...)]]></description>

</rule> </rules>

4- Restart your Sonar web server, your new XPath PMD rule is ready to be used and available in the rules list. 5- Activate the rule and launch the Sonar Maven goal on your project [1]

Regards, Freddy

[1] - http://skitch.com/freddymallet/bei8d/atos-pmd-xpath-rule

On Wed, Mar 18, 2009 at 8:45 AM, Alpesh <alpe@atosorigin.com> wrote:

Hi Olivier,

I went to the site but could only find the sample PMD for standard rule. I did some searching in the Sonar source and could find some extension examples unde this link

http://svn.codehaus.org/sonar/tags/1.6/tests/integration/extensions/checkstyle-rules-extensions/checkstyle-rules-extensions.xml

I tried to make the PMD.xml as per the sample but and place it in <sonar home>\extensions\rules\pmd and restart the server but I get the below mentioned error. I am attaching the modified PMD.xml that I use. Can you please let me know if there is any thing wrong in the format of that file.

wrapper | --> Wrapper Started as Console wrapper | Java Service Wrapper Community Edition 3.3.0 wrapper | Copyright (C) 1999-2008 Tanuki Software, Inc. All Rights Reserved. wrapper | http://wrapper.tanukisoftware.org wrapper | wrapper | Launching a JVM... wrapper | Startup failed: Timed out waiting for a signal from the JVM. jvm 1 | WrapperManager: Initializing... wrapper | Launching a JVM... jvm 2 | WrapperManager: Initializing... jvm 2 | WrapperManager Error: Failed to connect to the Wrapper at port 0. Cause: java.net.ConnectException: connect: Address is invalid on loc al machine, or port is not valid on remote machine jvm 2 | WrapperManager Error: Exiting JVM... wrapper | JVM exited while loading the application. wrapper | Launching a JVM... jvm 3 | WrapperManager: Initializing... jvm 3 | 2009-03-18 12:33:02.688::INFO: Logging to STDERR via org.mortbay.log.StdErrLog jvm 3 | 2009-03-18 12:33:02.862::INFO: jetty-6.1.11 jvm 3 | 2009-03-18 12:33:49.097::INFO: NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet jvm 3 | 2009-03-18 12:34:13.396::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext@a1320e {/,file:/C:/Installables/sonar-1 .6/sonar-1.6/war/sonar-web} jvm 3 | java.lang.RuntimeException: can not synchronize rules extensions of plugin : pmd jvm 3 | at

org.sonar.core.rules.RulesRepositorySynchronizer.registerRuleExtensions(RulesRepositorySynchronizer.java:187) jvm 3 | at

org.sonar.core.rules.RulesRepositorySynchronizer.synchronize(RulesRepositorySynchronizer.java:71) jvm 3 | at

org.sonar.core.database.SynchronizersBatch.startIn(SynchronizersBatch.java:39) jvm 3 | at

org.sonar.commons.database.DatabaseBatchStarter.start(DatabaseBatchStarter.java:30) jvm 3 | at

org.sonar.core.database.OperationalDatabaseListener.synchronizeDatabase(OperationalDatabaseListener.java:98) jvm 3 | at

org.sonar.core.database.OperationalDatabaseListener.doStart(OperationalDatabaseListener.java:71) jvm 3 | at

org.sonar.core.database.OperationalDatabaseListener.start(OperationalDatabaseListener.java:60) jvm 3 | at org.sonar.core.Application.start(Application.java:60) jvm 3 | at

org.sonar.web.listeners.ApplicationListener.contextInitialized(ApplicationListener.java:41) jvm 3 | at

org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543) jvm 3 | at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) jvm 3 | at

org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220) jvm 3 | at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513) jvm 3 | at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) jvm 3 | at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) jvm 3 | at

org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) jvm 3 | at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) jvm 3 | at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) jvm 3 | at org.mortbay.jetty.Server.doStart(Server.java:222) jvm 3 | at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) jvm 3 | at org.sonar.application.JettyEmbedder.start(JettyEmbedder.java:76) jvm 3 | at org.sonar.application.StartServer.main(StartServer.java:39) jvm 3 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) jvm 3 | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) jvm 3 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) jvm 3 | at java.lang.reflect.Method.invoke(Unknown Source) jvm 3 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:237) jvm 3 | at java.lang.Thread.run(Unknown Source) jvm 3 | Caused by: com.thoughtworks.xstream.converters.ConversionException: example : example : example : example jvm 3 | ---- Debugging information ---- jvm 3 | message : example : example jvm 3 | cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException jvm 3 | cause-message : example : example jvm 3 | class : java.util.ArrayList jvm 3 | required-type : ch.hortis.sonar.model.Rule jvm 3 | path : /rules/rule/example jvm 3 | line number : 12 jvm 3 | ------------------------------- jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:88) jvm 3 | at

com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) jvm 3 | at

com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) jvm 3 | at

com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:68) jvm 3 | at

com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:61) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) jvm 3 | at

com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:142) jvm 3 | at

com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33) jvm 3 | at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931) jvm 3 | at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917) jvm 3 | at com.thoughtworks.xstream.XStream.fromXML(XStream.java:869) jvm 3 | at

org.sonar.plugins.api.rules.StandardRulesXmlParser.parse(StandardRulesXmlParser.java:40) jvm 3 | at

org.sonar.plugins.pmd.PmdRulesRepository.parseReferential(PmdRulesRepository.java:62) jvm 3 | at

org.sonar.core.rules.RulesRepositorySynchronizer.registerRuleExtensions(RulesRepositorySynchronizer.java:183) jvm 3 | ... 27 more jvm 3 | Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: example : example jvm 3 | at

com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:62) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at com.thoughtworks.xstream.mapper.CGLIBMapper.realClass(CGLIBMapper.java:50) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:86) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:87) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38) jvm 3 | at

com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:52) jvm 3 | at

com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:318) jvm 3 | at

com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:196) jvm 3 | at

com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:150) jvm 3 | at

com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) jvm 3 | ... 45 more jvm 3 | 2009-03-18 12:34:14.560::INFO: Started SelectChannelConnector@0.0.0.0:9000 jvm 3 | Sonar listens http://0.0.0.0:9000/

Olivier Gaudin-2 wrote:

Hi,

In the sample you sent, there is a standard rule and a custom rule. It is fine to use the web interface for std rules, but there is different mechanism for custom. You can refer to http://docs.codehaus.org/display/SONAR/Extend+coding+rulesfor documentation on the process

On Tue, Mar 17, 2009 at 8:02 AM, Alpesh <alpe@atosorigin.com> wrote:

Hi I am trying to load a PMD file from eclipse but it does not load it and says "No profile created. Please check your configuration files". I dont get any error on the console.

I am attaching the sample of the file I am trying to upload. http://www.nabble.com/file/p22553503/02.1-package.xml 02.1-package.xml

-- View this message in context:

http://www.nabble.com/Problem-in-creating-profile---Importing-PMD-file-tp22553503p22553503.html

Sent from the Sonar mailing list archive at Nabble.com.

http://www.nabble.com/file/p22574053/pmd.xml pmd.xml