title: Get gradle build path folder from java
body: <p>I running a logger test that create some logs, and since I want those to be automatically deleted after the test pass or in the next gradle build execution, I would like to output the files into the build gradle folder.</p>
  
  <p>I´ve been looking how to point as relative path the build gradle folder from Java, but I could not find any answer.</p>
  
  <p>My test is in the folder structure</p>
  
  <pre><code> Project-&gt;src-&gt;main-&gt;java
  </code></pre>
  
  <p>And I would like to output the files into</p>
  
  <pre><code> Project-&gt;build
  </code></pre>
  
  <p>Any idea how to get that relative path?</p>
  
  <p><strong>SOLUTION</strong> </p>
  
  <pre><code>   String projectPath = System.getProperty("user.dir");
     rollingFileAppender.setFile(projectPath + File.separator + "/build/policy_rule_test.log");
  </code></pre>