The prefix “sonar” for element “sonar:sonar” is not bound

ⅰ亾dé卋堺 提交于 2019-12-22 03:23:38

问题


I have a build.xml-file that looks something like this:

<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml" classpath="/path/sonar-ant-task.jar"/>

<target name="sonar">       
    <sonar:sonar/>
</target>

And when I run the file I get:

The prefix "sonar" for element "sonar:sonar" is not bound.

Any obvious things I'm missing?


回答1:


You're missing the namespace declaration in the top project element of your Ant script.

xmlns:sonar="antlib:org.sonar.ant" ought to do it.




回答2:


In ant you can not use . try below and if you are setting any properties use key value pare in xml tag. To allocate value use attributes of xml tags.

 <sonar:sonar xmlns:sonar="antlib:org.sonar.ant">

</sonar:sonar>


来源:https://stackoverflow.com/questions/12860024/the-prefix-sonar-for-element-sonarsonar-is-not-bound

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!