Search code examples
linuxmavenconfigurationsesame

environment variable in a config.properties file


I'm trying to compile a Maven project that has a config.properties file. In the file, I have a set of environment variables that I have to set before compile.

In the config.properties file the variables are called like this:

${sys:rdfstore.host}:${sys:rdfstore.port}/openrdf-sesame/repositories/iserve/rdf-graphs/service

How do I have to set the variable rdfstore.host, and to what value should I set it to?

I have tried to solve this with:

export rdfstore.host="localhost"

However, with this I obtain a msj that is a invalid identifier, because it has a point "." How can I solve this problem?


Solution

  • You should be confusing environment variables and the set of sytem properties:

    • The properties exported from your system as you did with the export command are called environment variables and should not contain dots in the name. Those properties are then refered to using ${env.XXX}, meaning in your case you should change the variable name to:

      export RDFSTORE_HOST="localhost"

    It can then be referred to as below:

    `${env.RDFSTORE_HOST}`
    
    • System variables are those introcued in command line when invoking a maven phase, those ones can host dots in their names:

      mvn -Drdfstore.host="localhost"

    They can be referred to as follows:

    ${rdfstore.host}
    

    You can find more informations in the maven properties manual.