You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Tom Holmes Jr." <to...@tomholmes.net> on 2008/08/06 21:19:11 UTC

CPD using Java Call

We tried the CPD (from PMD) ant call, but because we have so many 
classes, we get an outofmemory exception.

We can do the java command-line which works fine and dumps the output to 
the command-line:
java -Xmx384m -classpath ../../.ant/lib/pmd-4.2.2.jar  
net.sourceforge.pmd.cpd.CPD --minimum-tokens 100 --files ./src --format 
net.sourceforge.pmd.cpd.XMLRenderer --output ./buildreports/report.cpd.xml

So, what I want to do is use the ant "java" task as listed below  so 
that the CPD runs in it's own JVM with a different heap space size.
<target name="cpd" depends="set_filters,prepare">
       <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" />
       <java classname="net.sourceforge.pmd.cpd.CPDTask" fork="true" >
           <arg value="--minimum-tokens 100"/>
           <arg value="--format net.sourceforge.pmd.cpd.XMLRenderer"/>
           <arg value="--files ${basedir}/src"/>
           <classpath>
               <pathelement location="${env.ANT_HOME}/lib"/>
               <pathelement 
location="${user.home}/.ant/lib/pmd-4.2.2.jar"/>
           </classpath>
           <jvmarg value="-Xmx384M"/>
       </java>
   </target>

But, in doing this I am getting the error:   NoClassDefFoundError:  
org/apache/tools/ant/Task
I didn't think I had to, or needed to, include the jars from ant.

Can anyone give me a quick solution ... I feel that I am almost there.    

Thanks!
                        Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: CPD using Java Call

Posted by Rod Mackenzie <ro...@googlemail.com>.
On 06/08/2008, Tom Holmes Jr. <to...@tomholmes.net> wrote:
>
> We tried the CPD (from PMD) ant call, but because we have so many classes,
> we get an outofmemory exception.



The PMD documentation suggests increasing Ants memory, have a look at the
end of following page for examples
http://pmd.sourceforge.net/ant-task.html

Rod


We can do the java command-line which works fine and dumps the output to the
> command-line:
> java -Xmx384m -classpath ../../.ant/lib/pmd-4.2.2.jar
>  net.sourceforge.pmd.cpd.CPD --minimum-tokens 100 --files ./src --format
> net.sourceforge.pmd.cpd.XMLRenderer --output ./buildreports/report.cpd.xml
>
> So, what I want to do is use the ant "java" task as listed below  so that
> the CPD runs in it's own JVM with a different heap space size.
> <target name="cpd" depends="set_filters,prepare">
>      <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" />
>      <java classname="net.sourceforge.pmd.cpd.CPDTask" fork="true" >
>          <arg value="--minimum-tokens 100"/>
>          <arg value="--format net.sourceforge.pmd.cpd.XMLRenderer"/>
>          <arg value="--files ${basedir}/src"/>
>          <classpath>
>              <pathelement location="${env.ANT_HOME}/lib"/>
>              <pathelement location="${user.home}/.ant/lib/pmd-4.2.2.jar"/>
>          </classpath>
>          <jvmarg value="-Xmx384M"/>
>      </java>
>  </target>
>
> But, in doing this I am getting the error:   NoClassDefFoundError:
>  org/apache/tools/ant/Task
> I didn't think I had to, or needed to, include the jars from ant.
>
> Can anyone give me a quick solution ... I feel that I am almost there.
> Thanks!
>                       Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>