You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Philipp Kraus <ph...@tu-clausthal.de> on 2016/05/26 10:50:47 UTC

class path within framework

Hello,

I’m deploying with Maven a framework (at the moment to my local repository) and
include this framework into other projects.

Within the framework I read a property file with:

final Properties l_property = new Properties();
l_property.load( a_class_within_my_framework.getClassLoader().getResourceAsStream( "configuration.properties" ) );

On the framework codes this works fine, but if I include with my framework in another project, it try to read the configuration.properties
from the project, not from the framework.
I have found out, that I should define the class path, but I don’t know how.
In my case the „configuration.property“ should read every time relative to the framework.

How I can fix this problem?

Thanks

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


Re: class path within framework

Posted by Philipp Kraus <ph...@tu-clausthal.de>.
Thanks a lot, it was my mistake, I have got an wrong path for my resources


Am 26.05.2016 um 13:14 schrieb Robert Patrick <ro...@oracle.com>:

> I assume that you don't want to put the properties file inside the framework jar (which is the easiest solution).
> 
> If the properties file is always at the same relative path to the framework jar, then you can simply add a Class-Path element in the framework jar's Manifest to include the directory where the properties file lives and it should "just work" without anyone needing to set the Classpath explicitly...
> 
>> On May 26, 2016, at 5:50 AM, Philipp Kraus <ph...@tu-clausthal.de> wrote:
>> 
>> Hello,
>> 
>> I’m deploying with Maven a framework (at the moment to my local repository) and
>> include this framework into other projects.
>> 
>> Within the framework I read a property file with:
>> 
>> final Properties l_property = new Properties();
>> l_property.load( a_class_within_my_framework.getClassLoader().getResourceAsStream( "configuration.properties" ) );
>> 
>> On the framework codes this works fine, but if I include with my framework in another project, it try to read the configuration.properties
>> from the project, not from the framework.
>> I have found out, that I should define the class path, but I don’t know how.
>> In my case the „configuration.property“ should read every time relative to the framework.
>> 
>> How I can fix this problem?
>> 
>> Thanks
>> 
>> Phil 
>> ---------------------------------------------------------------------
>> 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


Re: class path within framework

Posted by Robert Patrick <ro...@oracle.com>.
I assume that you don't want to put the properties file inside the framework jar (which is the easiest solution).

If the properties file is always at the same relative path to the framework jar, then you can simply add a Class-Path element in the framework jar's Manifest to include the directory where the properties file lives and it should "just work" without anyone needing to set the Classpath explicitly...

> On May 26, 2016, at 5:50 AM, Philipp Kraus <ph...@tu-clausthal.de> wrote:
> 
> Hello,
> 
> I’m deploying with Maven a framework (at the moment to my local repository) and
> include this framework into other projects.
> 
> Within the framework I read a property file with:
> 
> final Properties l_property = new Properties();
> l_property.load( a_class_within_my_framework.getClassLoader().getResourceAsStream( "configuration.properties" ) );
> 
> On the framework codes this works fine, but if I include with my framework in another project, it try to read the configuration.properties
> from the project, not from the framework.
> I have found out, that I should define the class path, but I don’t know how.
> In my case the „configuration.property“ should read every time relative to the framework.
> 
> How I can fix this problem?
> 
> Thanks
> 
> Phil 
> ---------------------------------------------------------------------
> 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