title: Failed to execute goal org.codehaus.mojo exec-maven-plugin while reading a config.xml file
body: <p>My code is working when I run it as java application in eclipse but it fails when I run maven install with maven-exec plug-in. I know that it it fails because of it doesn't find config file but how?</p>
  
  <p>If I exclude the maven-exec plugin it builds successfully and I can execute my jar file with dependencies.</p>
  
  <pre><code>public class App 
  {
      public static void main( String[] args )
      {
          System.out.println( "... starting DomParser" );
          System.out.println( "... inside app" );
  
          DOMParser.loadXML("/config.xml");
  
          System.out.println( "... ending DomParser" );
      }
  }
  </code></pre>
  
  <p>Here is the simplified DomParser class</p>
  
  <pre><code>static SAXBuilder builder = new SAXBuilder();
  static Document doc;
  public static void loadXML(String path) {
      java.net.URL url = DOMParser.class.getClass().getResource(path);
      doc = builder.build(url);
      root = doc.getRootElement();
  }
  </code></pre>
  
  <p>This is the pom.xml</p>
  
  <pre><code>&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.ericsson.ci.simnet&lt;/groupId&gt;
      &lt;artifactId&gt;domparser&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;domparser&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&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.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.14&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.jdom&lt;/groupId&gt;
              &lt;artifactId&gt;jdom2&lt;/artifactId&gt;
              &lt;version&gt;2.0.5&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
  
          &lt;!-- &lt;finalName&gt;${project.name}&lt;/finalName&gt; --&gt;
  
          &lt;plugins&gt;
              &lt;!-- Tell maven to compile using Java 1.7 --&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.2.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;test&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;java&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;mainClass&gt;com.x.ci.simnet.domparser.App&lt;/mainClass&gt;
                              &lt;arguments&gt;
                                  &lt;argument&gt;&lt;/argument&gt;
                              &lt;/arguments&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  
              &lt;!-- to bundle necessary classes of dependent JAR files --&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.5&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;shade&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;transformers&gt;
                                  &lt;transformer
                                      implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                                      &lt;mainClass&gt;com.x.ci.simnet.domparser.App&lt;/mainClass&gt;
                                  &lt;/transformer&gt;
                              &lt;/transformers&gt;
                              &lt;!--&lt;shadedArtifactAttached&gt;true&lt;/shadedArtifactAttached&gt; --&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Error is here:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default) on project domparser: An exception occured while executing the Java class. null: InvocationTargetException: NullPointerException -&gt; [Help 1]
  </code></pre>