title: Jenkins Non-readable POM
body: <p>This error is posted in different forums even <a href="https://stackoverflow.com/questions/46644233/non-readable-pom-permission-denied-when-running-build-in-jenkins">here</a>. I have tried the different alternatives. I tried changing the POM permissions. I am using the default maven settings. JDK is 8, Maven 3.5.3.</p>
  
  <p>I just want to try a very simple junit application. From the command line I have no problems running "mvn test"</p>
  
  <pre><code>junitexample amh$ mvn test
  [INFO] Scanning for projects...
  [INFO] 
  [INFO] ----------------------&lt; com.junit:junit-example &gt;-----------------------
  [INFO] Building junit-example 1.0-SNAPSHOT
  [INFO] --------------------------------[ jar ]---------------------------------
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ junit-example ---
  [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
  [INFO] Copying 0 resource
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ junit-example ---
  [INFO] Nothing to compile - all classes are up to date
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ junit-example ---
  [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
  [INFO] skip non existing resourceDirectory /Users/amhg/Documents/dev/intellik2/junitexample/src/test/resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ junit-example ---
  [INFO] Nothing to compile - all classes are up to date
  [INFO] 
  [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ junit-example ---
  [INFO] Surefire report directory: /Users/amhg/Documents/dev/intellik2/junitexample/target/surefire-reports
  
  -------------------------------------------------------
   T E S T S
  -------------------------------------------------------
  Running CalculatorTest
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 sec
  
  Results :
  
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1.178 s
  [INFO] Finished at: 2018-04-08T01:39:52+02:00
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>But from Jenkins, from the Console Output I have this error:</p>
  
  <p>Console Output</p>
  
  <pre><code>Started by user Andrea
  Building in workspace /Users/Shared/Jenkins/Home/workspace/calc
  [calc] $ /Users/amhg/apache-maven-3.5.3/bin/mvn -f /Users/amhg/Documents/dev/intellik2/junitexample test
  POM file /Users/amhg/Documents/dev/intellik2/junitexample specified with the -f/--file command line argument does not exist
  [INFO] Scanning for projects...
  [ERROR] [ERROR] Some problems were encountered while processing the POMs:
  [FATAL] Non-readable POM /Users/amhg/Documents/dev/intellik2/junitexample: /Users/amhg/Documents/dev/intellik2/junitexample (Permission denied) @ 
   @ 
  [ERROR] The build could not read 1 project -&gt; [Help 1]
  [ERROR]   
  [ERROR]   The project  (/Users/amhg/Documents/dev/intellik2/junitexample) has 1 error
  [ERROR]     Non-readable POM /Users/amhg/Documents/dev/intellik2/junitexample: /Users/amhg/Documents/dev/intellik2/junitexample (Permission denied)
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
  Build step 'Invoke top-level Maven targets' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>This is my POM file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit-example&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;junit-example&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.11&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>And I just have a simple test:</p>
  
  <pre><code>import org.junit.BeforeClass;
  import org.junit.Test;
  
  import static junit.framework.TestCase.assertEquals;
  
  public class CalculatorTest {
      private static ICalculator calculator;
  
      @BeforeClass
      public static void initCalculator() {
          calculator = new Calculator();
  
      }
  
      @Test
      public void testSum() {
          int result = calculator.sum(3, 4);
          assertEquals(7, result);
      }
  }
  </code></pre>
  
  <p>I don´t know what else I could try. I opened all the topics related to the problem. </p>
  
  <p>Any other suggestion?</p>