You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ross E Bundy <bu...@yahoo-inc.com> on 2009/04/21 20:08:43 UTC

Using a 'main' resource from a test

I've set up my project according to the directory structure show at:
   http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
I've included resources in both the test and main directories. There are some 'main' resources that I also need to access from my tests. I can access my test resources just fine, but I can't access the main resources from my tests. Is there a way to do this? The only way that I can find is to create links in my test resources directory to the files in the main resources directory.

Is there a better way?

Thanks,
--ross

Re: Using a 'main' resource from a test

Posted by Nick Stolwijk <ni...@gmail.com>.
What do you mean by access? Those resources in main should be on the
classpath during test execution.

With regards,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Tue, Apr 21, 2009 at 8:08 PM, Ross E Bundy <bu...@yahoo-inc.com> wrote:
> I've set up my project according to the directory structure show at:
>   http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
> I've included resources in both the test and main directories. There are some 'main' resources that I also need to access from my tests. I can access my test resources just fine, but I can't access the main resources from my tests. Is there a way to do this? The only way that I can find is to create links in my test resources directory to the files in the main resources directory.
>
> Is there a better way?
>
> Thanks,
> --ross
>

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


Re: Using a 'main' resource from a test

Posted by Nayan Hajratwala <na...@chikli.com>.
By default, classes under src/test/java should have access to:

  all classes under src/main/java & src/test/java
  all resources under src/main/resources & src/test/resources

There must be something else wrong. Can you post your pom?


On Tue, 21 Apr 2009 11:08:43 -0700, Ross E Bundy <bu...@yahoo-inc.com>
wrote:
> I've set up my project according to the directory structure show at:
>   
http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
> I've included resources in both the test and main directories. There are
> some 'main' resources that I also need to access from my tests. I can
> access my test resources just fine, but I can't access the main resources
> from my tests. Is there a way to do this? The only way that I can find is
> to create links in my test resources directory to the files in the main
> resources directory.
> 
> Is there a better way?
> 
> Thanks,
> --ross


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