Creating a jar with Maven project source code using the Maven directory structure?

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

+3
source share
2 answers

Why not use an existing maven-assembly-plugin descriptor ..

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

maven-assembly-plugin. , , .

:

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.2.1</version>
                    <executions>
                        <execution>
                            <id>make-distribution</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
                                </descriptors>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

src/main/assembly/assembly.xml:

<assembly>

        <id>my-project</id>

        <formats>
                <format>zip</format>
        </formats>

        <includeBaseDirectory>true</includeBaseDirectory>

        <fileSets>
                <fileSet>
                        <directory>${basedir}</directory>
                        <includes>
                                <include>**/**</include>
                        </includes>
                        <excludes>
                                <exclude>**/**</exclude>
                        </excludes>
                </fileSet>
        </fileSets>

</assembly>

, , .

0

All Articles