File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "properties in the same folder" Watch "properties in the same folder" New topic
Author

properties in the same folder

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 351
Hi

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

<report.receipt.properties.file.name></report.receipt.properties.file.name>

Any idea, please?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30506
    
150

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


[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: 16054
    
  21

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: http://aspose.com/file-tools
 
subject: properties in the same folder