Search code examples
javamavenmaven-2build

Generating a jar with the source code of the Maven project with the Maven directory structure?


I have a web application that I build with Maven into a war. But I want to generate a JAR with the maven project with the correct maven directory structure. I tried this but it throws away the Maven directory structure (src/main/java, etc.). My goal is to distribute this jar to other people so they can unpack and run mvn eclipse:eclipse and start working on their new web project.


Solution

  • Why not using the existing descriptor of maven-assembly-plugin..

    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <descriptorRefs>
        <descriptorRef>src</descriptorRef>
      </descriptorRefs>
    </configuratio