Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've found a solution to solve my problem: I search the properties files using the Groovy Maven plugin.</p> <p>As my properties file is necessarily in current directory, in ../ or in ../.., I wrote a small Groovy code that checks these three folders.</p> <p>Here is the extract of my pom.xml:</p> <pre><code>&lt;!-- Use Groovy to search the location of the properties file. --&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.groovy.maven&lt;/groupId&gt; &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt; &lt;version&gt;1.0-rc-5&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;validate&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;execute&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;source&gt; import java.io.File; String p = project.properties['env-properties-file']; File f = new File(p); if (!f.exists()) { f = new File("../" + p); if (!f.exists()) { f = new File("../../" + p); } } project.properties['env-properties-file-by-groovy'] = f.getAbsolutePath(); &lt;/source&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;!-- Now, I can load the properties file using the new 'env-properties-file-by-groovy' property. --&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.0-alpha-1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;initialize&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;read-project-properties&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;files&gt; &lt;file&gt;${env-properties-file-by-groovy}&lt;/file&gt; &lt;/files&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>This is working, but I don't really like it.</p> <p>So, if you have a better solution, do not hesitate to post!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload