title: How to create a jar from part of my project that is packaged as a war
body: <p>I'm a Maven newbie, so I apologize if this is something trivial. Basically, I am developing a webapp, and I am using Maven to manage the project. I have <code>&lt;packaging&gt;war&lt;/packaging&gt;</code> in my pom.xml so that that when I run <code>mvn package</code>, it will spit out a war file to deploy on the web server.</p>
  
  <p>Now, as part of this application, we are using a 3rd party library that is delivered to us as a war and it is deployed separately on the web server. This war includes some custom integration functionality that we code up. For the persistence logic, I originally just wrote up a repository straight in this integration code. As I find I'm needing more persistence logic (more than basic SELECTs), I'm finding I'm wanting to use repositories and domain objects found in our application code. So, ideally, I would like to be able to jar up our core packages, and then include that jar in this 3rd party war so I have the same functionality available to me there.</p>
  
  <p>I just don't know how I could set up the pom.xml to tell it what packages I would want in this jar (or even just 1 package if necessary), and how to create the jar itself. Is there a way to generate a jar from specific packages in a project that's setup to package the whole project as a war?</p>
  
  <p>I found information about the <a href="http://maven.apache.org/plugins/maven-jar-plugin/usage.html" rel="noreferrer">Maven jar plugin</a>, but it says, "If the packaging of your project is set to 'jar', this plugin is executed whenever it passes the "package" phase." The packaging in my project is not set to jar. Is there still some way to use this plugin?</p>