aspose file tools
The moose likes Ant, Maven and Other Build Tools and the fly likes properties in the same folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "properties in the same folder" Watch "properties in the same folder" New topic

properties in the same folder

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 435

I need a relative path in order to say my app that my properties file is in the same folder that the report which read them

I have a POM.xml and in there I have written something like


Any idea, please?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31551

Can you express the directory in relation to your project root (basedir)?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16458

What is the nature of this properties file? Is it used as part of the build process or is it used in the product that is produced?

Maven has an extreme dislike for absolute file paths when they're used by Maven itself. Maven was designed in such a way that if you do a "mvn clean" to remove superflous files, zip up the project directory, email it to someone on the other side of the planet, that the unzipped copy should be immediately buildable regardless of what OS or filesystem arrangements the recipient has. All Maven source paths are designed to be located at or below the project directory.

For a properties file used by the product of a Maven build, Maven could not care less where it's located nor whether the path is relative or absolute. That part is left up to whatever application installation process is used.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: properties in the same folder