What do you think? Discuss, post comments, or ask questions at the end of this article [More about me]

Skip to end of metadata
Go to start of metadata

Problem

Maven is wonderful.  However, often you might also want to produce a .jar for your .war maven project.

Solution

Add the following to your maven pom.xml.

<build>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        ...
        <configuration>
          <attachClasses>true</attachClasses>
        </configuration>
      </plugin>
	</plugins>
</build>

References

  1. https://stackoverflow.com/questions/10188495/how-to-use-class-file-from-another-war/10189767#10189767
  2. https://maven.apache.org/plugins/maven-war-plugin/faq.html#attached