ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roberto Juarez" <rjua...@omnilogic.es>
Subject Comparing Checkstyle and JUnit classpath usage patterns
Date Tue, 05 Oct 2004 10:19:48 GMT
Hi everyone,

I am using both Checkstyle and JUnit with Ant 1.6.2. It is very easy to use Checkstyle as
I only need to declare the task and provide it with the necessary jar files as follows (unnecesary
content removed):

  <property environment="env."/>
  <property name="develop.dir" value="${env.DEVELOP_HOME}"/>

  <!-- Directory mappings -->
  <property name="library.dir"  value="${develop.dir}/library"/>
  <property name="build.dir"    location="build"/>
  <property name="classes.dir"  location="${build.dir}/classes"/>
  <property name="junit.dir"         location="${build.dir}/junit"/>
  <property name="junit.classes.dir" location="${junit.dir}/classes"/>
  <property name="junit.data.dir"    location="${junit.dir}/data"/>
  <property name="junit.report.dir"  location="${junit.dir}/report"/>
  <property name="checkstyle.dir"        location="${build.dir}/checkstyle"/>
  <property name="checkstyle.data.dir"   location="${checkstyle.dir}/data"/>
  <property name="checkstyle.report.dir" location="${checkstyle.dir}/report"/>
  
  <!-- jars -->
  <property name="log4j.jar" value="${library.dir}/log4j-1.2.8.jar"/>
  <property name="junit.jar" value="${library.dir}/junit-3.8.1.jar"/>
  <property name="checkstyle.jar" value="${library.dir}/checkstyle-3.3.jar"/>
  <property name="antlr.jar" value="${library.dir}/antlr-2.7.2.jar"/>
  <property name="jakarta-regexp-1.2.jar"
            value="${library.dir}/jakarta-regexp-1.2.jar"/>
  <property name="jakarta-regexp-1.3.jar"
            value="${library.dir}/jakarta-regexp-1.3.jar"/>
  <property name="jakarta-oro.jar"
            value="${library.dir}/jakarta-oro-2.0.8.jar"/>
  <property name="commons-lang.jar"
            value="${library.dir}/commons-lang-2.0.jar"/>
  <property name="commons-beanutils.jar"
            value="${library.dir}/commons-beanutils-1.6.jar"/>
  <property name="commons-collections.jar"
            value="${library.dir}/commons-collections-2.1.jar"/>
  <property name="commons-logging.jar"
            value="${library.dir}/commons-logging-1.0.4.jar"/>
  <property name="lucene.jar"
            value="${library.dir}/lucene-1.3.jar"/>
            
  <!-- paths -->
  <path id="compile.classpath">
    <pathelement location="${log4j.jar}"/>
    <pathelement location="${commons-lang.jar}"/>
    <pathelement location="${lucene.jar}"/>
  </path>
  
  <path id="test.classpath">
    <path refid="compile.classpath"/>
    <pathelement location="${junit.jar}"/>
    <pathelement location="${classes.dir}"/>
    <pathelement location="${junit.classes.dir}"/>
  </path>
  
  <path id="checkstyle.classpath">
    <pathelement location="${checkstyle.jar}"/>
    <pathelement location="${antlr.jar}"/>
    <pathelement location="${jakarta-regexp-1.3.jar}"/>
    <pathelement location="${commons-beanutils.jar}"/>
    <pathelement location="${commons-collections.jar}"/>
    <pathelement location="${commons-logging.jar}"/>
  </path>
 
  <!-- taskdefs -->
  <taskdef name="checkstyle"
           classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
    <classpath refid="checkstyle.classpath"/>
  </taskdef>

  <!-- targets -->
  ...


On the other hand I can not do the same for JUnit. I looks like the only way to launch  JUnit
from Ant is to put the junit.jar file inside the lib directory of Ant or to put the junit.jar
file in the system classpath. This seems to me like brute force.

Has someone found a solution for this problem?

Roberto Juárez
Analyst programmer

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


Mime
View raw message