The prefix “sonar” for element “sonar:sonar” is no

2019-04-19 09:11发布

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?

标签: ant sonarqube
2条回答
叼着烟拽天下
2楼-- · 2019-04-19 09:37

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.

查看更多
放荡不羁爱自由
3楼-- · 2019-04-19 09:39

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>
查看更多
登录 后发表回答