title: Maven:adding dependencies and spring bean configuration file into the jar file
body: <p>I created the Spring Standalone Application,In that project i have the Java Classes,Spring Configuration File(applicationContext.xml) and the pom.xml file which contains the spring dependencies.</p>
  
  <p><strong>And this is the Structure of my project:</strong></p>
  
  <pre><code>ExampleProject
  |-- src/main/java
      |--org.example
         |--java Classes(MainApp.java)
  |-- applicationContext.xml
  |-- src/main/resource
  |-- src
  |-- target
  |-- pom.xml
  </code></pre>
  
  <p><strong>Problem:</strong>
  But my problem is when creating the jar file using the Maven Assembly plug-in it is adding only the maven dependencies and java class but not the spring configuration file.Can you provide me the good solution for adding the dependencies and spring bean configuration file into the jar file</p>
  
  <p><strong>Below is the pom.xml for your reference</strong> </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.iton.createjarProject&lt;/groupId&gt;
  &lt;artifactId&gt;createjarProject&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;properties&gt;
      &lt;org.springframework.version&gt;3.0.5.RELEASE&lt;/org.springframework.version&gt;
  &lt;/properties&gt;
  &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-expression&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  &lt;build&gt;
          &lt;plugins&gt; &lt;plugin&gt;
  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
  &lt;executions&gt;
    &lt;execution&gt;
      &lt;id&gt;unpack-dependencies&lt;/id&gt;
      &lt;phase&gt;prepare-package&lt;/phase&gt;
      &lt;goals&gt;
        &lt;goal&gt;unpack-dependencies&lt;/goal&gt;
      &lt;/goals&gt;
      &lt;configuration&gt;
        &lt;outputDirectory&gt;${project.build.directory}/classes&lt;/outputDirectory&gt;
      &lt;/configuration&gt;
    &lt;/execution&gt;
  
  &lt;/executions&gt;
  &lt;/plugin&gt;
  
  
  &lt;plugin&gt;
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
  &lt;executions&gt;
    &lt;execution&gt;
      &lt;id&gt;unpack-dependencies&lt;/id&gt;
      &lt;phase&gt;package&lt;/phase&gt;
    &lt;/execution&gt;
   &lt;/executions&gt;
   &lt;configuration&gt;
    &lt;archive&gt;
      &lt;manifest&gt;
        &lt;addClasspath&gt;true&lt;/addClasspath&gt;
        &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
        &lt;mainClass&gt;SimpleKeyLogger&lt;/mainClass&gt;
      &lt;/manifest&gt;
    &lt;/archive&gt;
   &lt;/configuration&gt;
  &lt;/plugin&gt;
  
          &lt;/plugins&gt;
  
  
  &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>