Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7045263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:30:34+00:00 2026-05-28T02:30:34+00:00

I want to share test resources between 2 modules A and B. In A

  • 0

I want to share test resources between 2 modules A and B. In A test resources I have directory with some files. Like this

-dir
----f1
----f2

I’ve done all according to Share test resources between maven projects . Now from B test I can access to resources using syntax like:

 this.getClass().getClassLoader().getResource("dir/f1")

And it’s works perfectly fine. But I don’t want hardcore all file names like f1 or f2. What I really want is getting all files from directory. Like

 File foo = new File(this.getClass().getClassLoader().getResource("dir").getFile());
 assert foo.isDirectory()
 foo.list()
 ...

But when I create foo in such way it even doesn’t exist (foo.exist() returns false).

How can I deal with it?

Update. Alternative solution using ant

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.5</version>
    <executions>
        <execution>
            <configuration>
                <target>
                    <fileset id="d" dir="${basedir}/src/test/resources/dir" includes="*"/>
                    <pathconvert property="d" refid="d">
                        <map from="${basedir}/src/test/resources/" to=""/>
                    </pathconvert>
                    <touch file="${basedir}/src/test/resources/d/listOfCharts.txt"/>
                    <echo file="${basedir}/src/test/resources/d/listOfCharts.txt" message="${charts}"/>
                </target>
            </configuration>
            <phase>package</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:30:35+00:00Added an answer on May 28, 2026 at 2:30 am

    The approach you talk about creates a JAR which can be used in later tests. You can’t list the contents of a Jar this way. You need to use Jar you need to read it as a Jar specially

    How do I list the files inside a JAR file?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP page and I want to share some data between pages
Say I have the following interface that I want to share between my server
Access for all files by default is private. But I want to share (time
I want to create flex/actionscript directory view for my files with php/mysql. I have
I want to share an object between my servlets and my webservice (JAX-WS) by
We want to share user validation configuration between a Java validation class (for sanity
This is the URL I want to share: http://mydomain.com/#url=http://stackoverflow.com Inside my site, I do
Looking for good project methodologies.Anyone got some good reference links..want to share.
I have a single Rails 2.2.2 app that I want to 'share' with multiple
On localhost. I have the following directory structure: /share/www/trunk/wp-content/plugins/otherfolders /share/www/portfolio/wp-content/symlink Where symlink is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.