maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Garnier <ma...@davidgarnier.com>
Subject Re: Maven can't load resources from target dir
Date Tue, 22 Jun 2004 03:42:23 GMT
Le mar 22/06/2004 à 02:17, Brett Porter a écrit :
> Is it possible that the resources arrive in target after the attempt
> to copy them as a resource?

Well I thought that Maven simply added the resources dir to the
classpath. But I couldn't find it in the classpath printed by the -X
option. But you're correct, the resources are not being copied to the
test-classes dir. I've changed the step that generated the resources
from a postGoal of test:test-resources to a preGoal, and now it works!
Thanks!

> I don't think keeping them in target is wise, regardless. If they are
> generated by the build, the build should put them in the right place
> to start with.

Well, the resources are generated by the build, and they are only used
by the tests, so from my point of view, target/res is the right dir.

Best Regards,

David


> - Brett
> 
> On Mon, 21 Jun 2004 22:23:20 +0200, David Garnier
> <maven@davidgarnier.com> wrote:
> > 
> > Hello,
> > 
> > It seems that Maven can't 'see' resources when they are in the target
> > dir. In the POM, I specified resources for the unit tests:
> > 
> > <resources>
> >         <resource>
> >                 <directory>${basedir}/target/res/</directory>
> >                 <targetPath>/</targetPath>
> >                 <includes>
> >                         <include>**/*</include>
> >                 </includes>
> >         </resource>
> > </resources>
> > 
> > This does not work. When I try to load a file using something like this
> > :
> > retval.getClass().getResourceAsStream("/netlist.txt");
> > 
> > I get a null InputStream. The resources are dynamically generated in a
> > post-goal on test:test-resources, but I've confirmed that the files are
> > indeed present.
> > 
> > Now here is the interesting part. If I generate the resources in
> > ${basedir}/res instead of ${basedir}/target/res, maven:site will find
> > the files. I've set maven.junit.fork to true, otherwise Maven does not
> > find the files at all.
> > 
> > Is this a bug or a specified behavior?
> > 
> > Best Regards,
> > David Garnier
> > --
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
David Garnier <david@davidgarnier.com>
-- 



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


Mime
View raw message