Grokbase Groups Maven users May 2003
FAQ
I wish to add additional classpath entries when I run

maven test

because there are additional resources that must be present in the classpath. For instance
I am generating test cases that test ResourceBundles, so I need the .properties files in the
classpath. How can I accomplish this?

Thanks, Steve

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

Search Discussions

  • Alex Vollmer at May 30, 2003 at 5:25 pm
    You can do this by adding a <resources> stanza to your <unitTests>
    declaration in your project.xml. For example...

    <unitTest>
    <includes>
    <include>**/*Test.java</includes>
    </includes>
    <resources>
    <resource>
    <directory>src/java</directory>
    <includes>
    <include>**/*.properties</include>
    </includes>
    </resource>
    </resources>
    </unitTest>

    The only problem I've seen with this is that the 'test:test-resources'
    task doesn't seem to execute this if you invoke this project from
    another one using Reactor (can anyone shed some light on this?). So the
    other way you could do it is to add a <postGoal> definition to the
    maven.xml file (same directory as your project.xml) that looks like this:

    <postGoal name="test:compile">
    <ant:copy dir="${maven.build.dir}/test-classes">
    <ant:fileset dir="${basedir}/src/java">
    <ant:includes>
    <ant:include name="**/*.properties"/>
    </ant:includes>
    </ant:fileset>
    </ant:copy>
    </postGoal>

    Either way, the net effect is to put these files in the
    target/test-classes directory so that when you run your unit-tests these
    files show up in the CLASSPATH.

    --Alex

    Steve Garcia wrote:
    I wish to add additional classpath entries when I run

    maven test

    because there are additional resources that must be present in the classpath. For instance
    I am generating test cases that test ResourceBundles, so I need the .properties files in the
    classpath. How can I accomplish this?

    Thanks, Steve

    ---------------------------------------------------------------------
    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
  • Michal Maczka at May 30, 2003 at 5:28 pm
    It is usually good idea to read manual (User Guide):
    http://maven.apache.org/reference/user-guide.html#Test%20Resources

    Michal
    -----Original Message-----
    From: Steve Garcia
    Sent: Friday, May 30, 2003 7:12 PM
    To: Maven Mailing List (E-mail)
    Subject: How to add classpath to JUnit Tests


    I wish to add additional classpath entries when I run

    maven test

    because there are additional resources that must be present in
    the classpath. For instance
    I am generating test cases that test ResourceBundles, so I need
    the .properties files in the
    classpath. How can I accomplish this?

    Thanks, Steve

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


    ----------------------------------------------------------------------
    Wizyta Busha w INTERIA.PL >>> http://link.interia.pl/f172d


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Steve Garcia at May 30, 2003 at 5:30 pm
    I have read the user manual, but I have found inconsistencies with it in the past so I'm a little hesistant to completely trust it.

    Thanks, Steve

    -----Original Message-----
    From: Michal Maczka
    Sent: Friday, May 30, 2003 10:29 AM
    To: Maven Users List
    Subject: RE: How to add classpath to JUnit Tests


    It is usually good idea to read manual (User Guide):
    http://maven.apache.org/reference/user-guide.html#Test%20Resources

    Michal
    -----Original Message-----
    From: Steve Garcia
    Sent: Friday, May 30, 2003 7:12 PM
    To: Maven Mailing List (E-mail)
    Subject: How to add classpath to JUnit Tests


    I wish to add additional classpath entries when I run

    maven test

    because there are additional resources that must be present in
    the classpath. For instance
    I am generating test cases that test ResourceBundles, so I need
    the .properties files in the
    classpath. How can I accomplish this?

    Thanks, Steve

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


    ----------------------------------------------------------------------
    Wizyta Busha w INTERIA.PL >>> http://link.interia.pl/f172d


    ---------------------------------------------------------------------
    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
  • Steve Garcia at May 30, 2003 at 5:39 pm
    Although in the case of my previous question I think the manual is straight forward.

    On this topic in general, I am confused about some things in the manual. For instance does Maven support the <unitTest> and <unitTestPatterns> elements in the <build> node? I'm playing around with it now to see if there is a difference.

    Regards, Steve

    -----Original Message-----
    From: Steve Garcia
    Sent: Friday, May 30, 2003 10:30 AM
    To: Maven Users List
    Subject: RE: How to add classpath to JUnit Tests


    I have read the user manual, but I have found inconsistencies with it in the past so I'm a little hesistant to completely trust it.

    Thanks, Steve

    -----Original Message-----
    From: Michal Maczka
    Sent: Friday, May 30, 2003 10:29 AM
    To: Maven Users List
    Subject: RE: How to add classpath to JUnit Tests


    It is usually good idea to read manual (User Guide):
    http://maven.apache.org/reference/user-guide.html#Test%20Resources

    Michal
    -----Original Message-----
    From: Steve Garcia
    Sent: Friday, May 30, 2003 7:12 PM
    To: Maven Mailing List (E-mail)
    Subject: How to add classpath to JUnit Tests


    I wish to add additional classpath entries when I run

    maven test

    because there are additional resources that must be present in
    the classpath. For instance
    I am generating test cases that test ResourceBundles, so I need
    the .properties files in the
    classpath. How can I accomplish this?

    Thanks, Steve

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


    ----------------------------------------------------------------------
    Wizyta Busha w INTERIA.PL >>> http://link.interia.pl/f172d


    ---------------------------------------------------------------------
    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


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmaven
postedMay 30, '03 at 5:12p
activeMay 30, '03 at 5:39p
posts5
users3
websitemaven.apache.org
irc#maven

People

Translate

site design / logo © 2019 Grokbase