eXtreme Development

Maven - como gerar um zip ao inves de um jar

criar arquivo assembly.xml no diretório raiz do projeto (o mesmo do pom.xml)

colocar o seguinte conteudo no assembly.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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">
	<formats>
		<format>zip</format>
	</formats>
	<fileSets>
		<fileSet>
			<directory>src/main/java/com/eidosmedia/webapp/custom/db/auditlog/eventtracker/automation</directory>
			<!-- outputDirectory defines the directory structure below eventtracker-automation-X.Y.Z -->
			<outputDirectory>/</outputDirectory>
		</fileSet>
	</fileSets>
</assembly>

editar pom.xml:
<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	...
	<!-- distributionManagement é usado pra definir a url do Nexus -->
	<distributionManagement>
		<repository>
			<id>releases</id>
			<name>Nexus Releases Repository</name>
			<url>http://eidos01maven:8080/nexus/content/repositories/releases</url>
		</repository>
		<snapshotRepository>
			<id>snapshots</id>
			<name>Nexus Snapshots Repository</name>
			<url>http://eidos01maven:8080/nexus/content/repositories/snapshots</url>
		</snapshotRepository>
	</distributionManagement>
	<build>
		<plugins>
			<!-- Prevent maven from creating an empty jar file -->
			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<executions>
					<execution>
						<id>default-jar</id>
						<phase>never</phase>
						<configuration>
							<finalName>unwanted</finalName>
							<classifier>unwanted</classifier>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<executions>
					<execution>
						<id>create-distribution</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<descriptors>
								<descriptor>assembly.xml</descriptor>
							</descriptors>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>


SourceForge BootStrap