You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ZJacobson <ja...@gmail.com> on 2009/07/08 00:25:33 UTC

running junit test via ant using antrun plugin

Hi-

I must be doing something really stupid.  I can't get ant to use junit 4
when invoked via the antrun plugin.  My tests all fail because the test
runner can't find any tests (since none of the tests extend TestCase). If I
just run the tests via the ant script, the tests run and pass.  But when I
run via maven (which antcall's the same ant script) the test don't run.  Is
there a way to figure out why it seems that ant is only finding junit 3.x? 
mvn -X doesn't give me ant -debug.

This is the configuration of maven-antrun-plugin:
     <executions>
          <execution>
            <id>ant-tests</id>
            <phase>test</phase>
            <configuration>
              <tasks>
                <ant antfile="${basedir}/build.xml">
                  <target name="test"/>
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
      </executions>

      <dependencies>
         <dependency>
          <groupId>ant</groupId>
          <artifactId>ant-nodeps</artifactId>
          <version>1.7.0</version>
         </dependency>
         <dependency>
          <groupId>ant</groupId>  
          <artifactId>ant-junit</artifactId>  
          <version>1.6.5</version>  
         </dependency>  
         <dependency>  
          <groupId>junit</groupId>  
          <artifactId>junit</artifactId>  
          <version>4.4</version>
         </dependency>
      </dependencies>

Thanks-
Zak

-- 
View this message in context: http://www.nabble.com/running-junit-test-via-ant-using-antrun-plugin-tp24382461p24382461.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: running junit test via ant using antrun plugin

Posted by ZJacobson <ja...@gmail.com>.
I didn't see junit 3 in the dependency tree.  I'm just using junit 4.


javabrett wrote:
> 
> I've not dealt with this before so take this advice with a grain of 
> salt, but here's something to try: Run mvn dependency:tree to see if 
> another dependency elsewhere is relying on junit 3.x - maybe you can fix 
> or exclude it.
> 
> Best
> Brett
> 
> ZJacobson wrote:
>> Hi-
>>
>> I must be doing something really stupid.  I can't get ant to use junit 4
>> when invoked via the antrun plugin.  My tests all fail because the test
>> runner can't find any tests (since none of the tests extend TestCase). If
>> I
>> just run the tests via the ant script, the tests run and pass.  But when
>> I
>> run via maven (which antcall's the same ant script) the test don't run. 
>> Is
>> there a way to figure out why it seems that ant is only finding junit
>> 3.x? 
>> mvn -X doesn't give me ant -debug.
>>
>> This is the configuration of maven-antrun-plugin:
>>      <executions>
>>           <execution>
>>             <id>ant-tests</id>
>>             <phase>test</phase>
>>             <configuration>
>>               <tasks>
>>                 <ant antfile="${basedir}/build.xml">
>>                   <target name="test"/>
>>                 </ant>
>>               </tasks>
>>             </configuration>
>>             <goals>
>>               <goal>run</goal>
>>             </goals>
>>           </execution>
>>       </executions>
>>
>>       <dependencies>
>>          <dependency>
>>           <groupId>ant</groupId>
>>           <artifactId>ant-nodeps</artifactId>
>>           <version>1.7.0</version>
>>          </dependency>
>>          <dependency>
>>           <groupId>ant</groupId>  
>>           <artifactId>ant-junit</artifactId>  
>>           <version>1.6.5</version>  
>>          </dependency>  
>>          <dependency>  
>>           <groupId>junit</groupId>  
>>           <artifactId>junit</artifactId>  
>>           <version>4.4</version>
>>          </dependency>
>>       </dependencies>
>>
>> Thanks-
>> Zak
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/running-junit-test-via-ant-using-antrun-plugin-tp24382461p24501748.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: running junit test via ant using antrun plugin

Posted by Brett Randall <ja...@gmail.com>.
I've not dealt with this before so take this advice with a grain of 
salt, but here's something to try: Run mvn dependency:tree to see if 
another dependency elsewhere is relying on junit 3.x - maybe you can fix 
or exclude it.

Best
Brett

ZJacobson wrote:
> Hi-
>
> I must be doing something really stupid.  I can't get ant to use junit 4
> when invoked via the antrun plugin.  My tests all fail because the test
> runner can't find any tests (since none of the tests extend TestCase). If I
> just run the tests via the ant script, the tests run and pass.  But when I
> run via maven (which antcall's the same ant script) the test don't run.  Is
> there a way to figure out why it seems that ant is only finding junit 3.x? 
> mvn -X doesn't give me ant -debug.
>
> This is the configuration of maven-antrun-plugin:
>      <executions>
>           <execution>
>             <id>ant-tests</id>
>             <phase>test</phase>
>             <configuration>
>               <tasks>
>                 <ant antfile="${basedir}/build.xml">
>                   <target name="test"/>
>                 </ant>
>               </tasks>
>             </configuration>
>             <goals>
>               <goal>run</goal>
>             </goals>
>           </execution>
>       </executions>
>
>       <dependencies>
>          <dependency>
>           <groupId>ant</groupId>
>           <artifactId>ant-nodeps</artifactId>
>           <version>1.7.0</version>
>          </dependency>
>          <dependency>
>           <groupId>ant</groupId>  
>           <artifactId>ant-junit</artifactId>  
>           <version>1.6.5</version>  
>          </dependency>  
>          <dependency>  
>           <groupId>junit</groupId>  
>           <artifactId>junit</artifactId>  
>           <version>4.4</version>
>          </dependency>
>       </dependencies>
>
> Thanks-
> Zak
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org