javaubuntuantnutch

Nutch - Could not load definitions from resource org/sonar/ant/antlib.xml


I'm learning Nutch through the official guide. So when I run Ant at bin directory, it says:

"Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found."

I've spent a lot of time in google to solve it, but I failed. My OS is Ubuntu16.04.

enter image description


Solution

  • Try to comment all this part in build.xml:

      <!-- ================================================================== -->
      <!-- SONAR targets                                                      -->
      <!-- ================================================================== -->
    
      <!-- Define the Sonar task if this hasn't been done in a common script -->
      <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
        <classpath path="${ant.library.dir}"/>
        <classpath path="${mysql.library.dir}"/>
      </taskdef>
    
      <!-- Add the target -->
      <target name="sonar" description="--> run SONAR analysis">
    
        <!-- list of mandatory source directories (required) -->
        <property name="sonar.sources" value="${src.dir}"/>
    
        <!-- list of properties (optional) -->
        <property name="sonar.projectName" value="Nutch Trunk 1.4 Sonar Analysis" />
        <property name="sonar.binaries" value="${build.dir}/classes" />
        <property name="sonar.binaries" value="${build.dir}/plugins" />
        <property name="sonar.tests" value="${test.src.dir}" />
    
        <sonar:sonar workDir="${base.dir}" key="org.apache.nutch:trunk" 
         version="1.4-SNAPSHOT" xmlns:sonar="antlib:org.sonar.ant"/>
      </target>
    

    in this way, it should work.