I have a multi-module maven project with the below hierarchy and wanted to create a zip after the mvn build and curl or upload it to one private repository. I am using the maven-assembly-plugin but it is not including the required directory. Please can you suggest something?
|--subproject1 |--src/main/.. |--resoruces/.. |target/.. |pom.xml |--subproject2 |--src/main/.. |--resoruces/.. |pom.xml pom.xml``` content of zip.xml <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>project</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <!--<fileSet></fileSet>--> <fileSets> <fileSet> <directory>${project.basedir}/subproject1</directory> <outputDirectory></outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> <excludes> <exclude>**/*.log</exclude> </excludes> </fileSet> </fileSets> <files> <file> <source> ${project.basedir}/pom.xml</source> <outputDirectory>/</outputDirectory> </file> </files> </assembly> below plugin is added in pom.xml of subproject1 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <appendAssemblyId>true</appendAssemblyId> <descriptors> <descriptor>zip.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin>
I wanted to create a zip with subproject1 includes src, resources, and target folder. Kindly assist.
Advertisement
Answer
Using “jar -cf project.zip project-name” command, zip is getting created.