Wayne,
Thanks for the solutions you've provided.   I went with the 2nd choice and
got my JUnit tests to build and execute.   Thanks again, very much
appreciate the help.

Enrique



"Wayne Fay" <[EMAIL PROTECTED]> wrote on 04/18/2007 11:22:41 AM:

> I figured as much. Here's your problem...
>
> Your junit artifact is brought in with scope test.
>
> Your test is currently situated in src/main/java which is "main java
> code" directory. So when maven-compiler is trying to compile your
> code, the junit dependency is not available.
>
> You have two choices:
> 1. Change junit scope to "compile". This will get you past your
> current problems but its really not the proper solution.
> 2. Move your test(s) to src/test/java. This is the "proper" solution.
>
> There's actually another choice in there where you would use
> resources, testSourceDirectory, includes and excludes to make things
> work but its complicated and I'm not going to recommend that approach.
>
> Wayne
>
> On 4/18/07, Enrique Gaona <[EMAIL PROTECTED]> wrote:
> >
> > Arik,
> > Thanks for the tip.  I got a bit further and it actually tries to build
> > AssetManagerTest.java files, but its failing saying it can't find
> > junit.framework.  junit is located in
~/.m2/repository/junit/junit/3.8.1
> > directory.   I have the import junit.framework.* in my code, so not
sure
> > why it can't find the package.  Any ideas?
> >
> > /home/egaona/projects/csdp_build/sources/csdp/com.ibm.csdp.bss.
> catalog/catalog.repository.
>
cmd/src/main/java/com/ibm/csdp/bss/catalog/repository/client/main/AssetManagerTest.

> java:[22,0]
> >  package junit.framework does not exist
> >
> > /home/egaona/projects/csdp_build/sources/csdp/com.ibm.csdp.bss.
> catalog/catalog.repository.
>
cmd/src/main/java/com/ibm/csdp/bss/catalog/repository/client/main/AssetManagerTest.

> java:[30,38]
> >  cannot resolve symbol
> > symbol  : class TestCase
> > location: class
> > com.ibm.csdp.bss.catalog.repository.client.main.AssetManagerTest
> >
> > Wayne,
> > The file is called AssetManagerTest.java. The pom.xml is located in
> > ~/catalog.repository.cmd while the AssetManagerTest.java is in
> > catalog.repository.
> cmd/src/main/java/com/ibm/csdp/bss/catalog/repository/client/main/
> >  directory.
> >
> > Thanks.
> >
> > Enrique
> >
> >
> >
> > "Arik Kfir" <[EMAIL PROTECTED]> wrote on 04/18/2007 09:59:50 AM:
> >
> > > try:
> > >
> > > <include>**/AssetManagerTest.java</include>
> > >
> > > On 4/18/07, Enrique Gaona <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > Hi,
> > > > I'm trying to run a JUnit test in Maven, but for some reason, the
tests
> > > > are
> > > > being skipped.  In my pom.xml file, I have the junit dependency and
> > added
> > > > the maven-surefire-plugin in the hopes my JUnit test gets invoked.
> > > >
> > > > <dependency>
> > > >         <groupId>junit</groupId>
> > > >         <artifactId>junit</artifactId>
> > > >         <version>3.8.1</version>
> > > >         <scope>test</scope>
> > > > </dependency>
> > > >
> > > > <plugin>
> > > >           <groupId>org.apache.maven.plugins</groupId>
> > > >           <artifactId>maven-surefire-plugin</artifactId>
> > > >           <configuration>
> > > >                       <includes>
> > > >
> > <include>AssetManagerTest.java</include>
> > > >                        </includes>
> > > >            </configuration>
> > > > </plugin>
> > > >
> > > > Is there anything I need to do different?   The Junit test is 10
> > > > sub-directories deep from the pom.xml, but I don't think this is an
> > issue.
> > > > I've also included a screenshot of the output from the mvn test
> > command.
> > > > Thanks in advance.
> > > >
> > > > Screenshot from mvn test command:
> > > > [EMAIL PROTECTED]
> > > > :~/projects/csdp_build/sources/csdp/com.ibm.csdp.bss.
> > > catalog/catalog.repository.cmd>
> > > > mvn test
> > > > [INFO] Scanning for projects...
> > > > [INFO]
> > > >
> > > >
> >
----------------------------------------------------------------------------

> >
> > > > [INFO] Building catalog.repository.cmd
> > > > [INFO]    task-segment: [test]
> > > > [INFO]
> > > >
> > > >
> >
----------------------------------------------------------------------------

> >
> > > > [INFO] [buildnumber:create {execution: default}]
> > > > [INFO] Build Number: 20070418-0955
> > > > [INFO] [resources:resources]
> > > > [INFO] Using default encoding to copy filtered resources.
> > > > [WARNING]
> > > >         Artifact junit:junit:jar:3.8.1:test retains local scope
'test'
> > > > overriding broader scope 'compile'
> > > >         given by a dependency. If this is not intended, modify or
> > remove
> > > > the local scope.
> > > >
> > > > [INFO] [compiler:compile]
> > > > [INFO] Nothing to compile - all classes are up to date
> > > > [INFO] [resources:testResources]
> > > > [INFO] Using default encoding to copy filtered resources.
> > > > [INFO] [compiler:testCompile]
> > > > [INFO] Not compiling test sources
> > > > [INFO] [surefire:test]
> > > > [INFO] Tests are skipped.
> > > > [INFO]
> > > >
> >
------------------------------------------------------------------------
> > > > [INFO] BUILD SUCCESSFUL
> > > > [INFO]
> > > >
> >
------------------------------------------------------------------------
> > > > [INFO] Total time: 12 seconds
> > > > [INFO] Finished at: Wed Apr 18 09:55:18 CDT 2007
> > > > [INFO] Final Memory: 15M/36M
> > > > [INFO]
> > > >
> >
------------------------------------------------------------------------
> > > >
> > > >
> > > > Enrique
> > > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Reply via email to