title: How do I exclude java files from a jar in maven-jar-plugin?
body: <p>I created a <strong>pom.xml</strong> to compile my project and package it as a jar,
  and indeed it comiples and the jar is created - problem is that i got a jar with both classes and java inside, and i only  want the classes inside.</p>
  
  <p>How do I lose the java files? I don’t need them.</p>
  
  <p>this is the <strong>pom.xml</strong> that i created:</p>
  
  <pre><code>&lt;build&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/java&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
          &lt;finalName&gt;api-interfaces&lt;/finalName&gt;
          &lt;plugins&gt;
          &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;make-a-jar&lt;/id&gt;
                          &lt;phase&gt;compile&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;jar&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;configuration&gt;
            &lt;excludes&gt;
              &lt;exclude&gt;*.properties&lt;/exclude&gt;
                &lt;exclude&gt;*.xml&lt;/exclude&gt;
                 &lt;exclude&gt;sql/**&lt;/exclude&gt;
                  &lt;exclude&gt;META-INF/**&lt;/exclude&gt;
                   &lt;exclude&gt;*.jar&lt;/exclude&gt;
                    &lt;exclude&gt;*.java&lt;/exclude&gt;
                     &lt;exclude&gt;default-configs/**&lt;/exclude&gt;
  
            &lt;/excludes&gt;
            &lt;/configuration&gt;
          &lt;/plugin&gt;
         &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Em3d1.jpg" alt="this is the jar that i get"></p>