title: How do I organize a project with a shared library in Maven
body: <p>I am wondering if this the correct way to structure my project and how I can configure it so that I can build/test/package all of its individual components from a single build command?</p>
  
  <p>I have a Maven project that contains multiple modules- Spring apps and a "library" shared between them as a dependency. I would like to be able to build all the apps together with the library so that I can execute integration tests whenever any of the modules change (lib or app). </p>
  
  <p>Ideally, I should be able to compile each component, run unit tests per app/library, run integration tests, package each component into its executable jar. At some point, this process will be run on a Jenkins server with higher-level system tests.</p>
  
  <p>Right now, I am using <code>mvn clean install spring-boot:repackage</code>. This works for each app individually,i.e. when running from <code>Main Project/App1/</code>. However, when I run it from the project root <code>Main Project/</code>, I am getting an error that the library cannot be spring-repackage'd because the library does not have a main class. This is fine- it's a library, it does not need an entry point.</p>
  
  <p>So is this the correct way to structure a multi-app project in Maven or am I doing something very wrong?</p>
  
  <p>The project structure is:</p>
  
  <pre><code>Main Project
  |-SharedLibrary/
    |-src/
    |-pom.xml
  |-App1/
    |-src/
    |-pom.xml
  |-App2/
    |-src/
    |-pom.xml
  |-App3/
    |-src/
    |-pom.xml
  |-pom.xml
  </code></pre>