marko
marko

Reputation: 3776

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

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?

Upvotes: 14

Views: 6989

Answers (2)

Vishal Akkalkote
Vishal Akkalkote

Reputation: 1341

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>

Upvotes: 1

David
David

Reputation: 2702

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.

Upvotes: 28

Related Questions