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 8885389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:18:00+00:00 2026-06-14T21:18:00+00:00

I want to reference a resource file, which is a keystore file, inside a

  • 0

I want to reference a resource file, which is a keystore file, inside a Java test class. This property is normally loaded from a properties file which points to the JDK running either locally or remotely.

When Maven executes a build as part of my deploy process it is first built on a build server. I want to be able place the keystore file on the classpath so i dont have to put a hard dependency on the build server (whereby i would place the keystore on the build server)

When i wire up the unit test locally it works fine with this configuration however this path fails when i execute the build on the build server. Can anyone shed some light on why this is failing? and what i can do to resolve? I think i know the why but clarification would be great.

Current configuration

<bean id="httpClient"
    class="myapp.HTTPClient">
    <property name="trustStoreLocation" value="..\\mywebapp\\target\\test-classes\\truststore" />
    <property name="trustStorePass" value="mypass" />
</bean>
  • 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-06-14T21:18:01+00:00Added an answer on June 14, 2026 at 9:18 pm

    For resource files, I prefer following the standard directory structure for Maven. Please read (http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html) for more reference. Placing a file like (.cfg or .jks or .properties) in src/test/resources and src/main/resources automatically makes the available in the class path upon build. Further, it give you the ability to isolate your test and main resource files.

    For example, my pom.xml looks like this:

    <build>
        <finalName>${project.artifactId}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/config</directory>
            </resource>
             <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/main/config</directory>
            </testResource>
             <testResource>
                <directory>src/main/resources</directory>
            </testResource>
        </testResources>
    
        <!-- Other pom.xml stuff -->
    
    </build>
    

    Now, a simple way to verify if your file has been copied properly is to tabulate the jar and check for the file you want.

    mvn build
    

    Then do:

    jar -tf target/<your project jar>.jar | grep "<file name you want to verify>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an icon in my resource file , which I want to reference.
In this particular code sample I want to reference the second overloaded method (int
I want to get reference on BaseController from AppDelegate. My MainMenu.xib's hierarchy is where
I want to have a reference data member in a class, but I do
I want to test (true or false) whether an arbitrary XML file matches a
I want to use a data file and read it from a WinForms app.
There is Java tool (it is called Mallet) http://mallet.cs.umass.edu/download.php which I want to use
I have a testing server which runs headless. One test I want is to
I'm working on iOS application in which i want XML file to be the
Like the asker of the question here Variable substitution JSF Resource Bundle property file

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.