1 Haziran 2023 Perşembe

assembly plugin - format=dir

Örnek
Projeyi yeni bir module ekleriz. İsmi packaging. Şöyle yaparız. app ve tools isimli iki tane module için de bağımlılığı var.
<?xml version="1.0" encoding="UTF-8"?>
<project ..."> <parent> <artifactId>root</artifactId> <groupId>org.everydaycodes</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <packaging>pom</packaging> <artifactId>packaging</artifactId> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>3.3.0</version> <executions> <execution> <id>build-package</id> <goals> <goal>single</goal> </goals> <phase>package</phase> <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.everydaycodes</groupId> <artifactId>app</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.everydaycodes</groupId> <artifactId>tools</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </project>
assembly.xml şöyledir
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> <id>production-artifact</id> <formats> <format>dir</format> </formats> <dependencySets> <dependencySet> <useProjectArtifact>false</useProjectArtifact> <outputDirectory>shared</outputDirectory> <unpack>false</unpack> <excludes> <exclude>org.everydaycodes:app:*</exclude> <exclude>org.everydaycodes:tools:*</exclude> </excludes> </dependencySet> </dependencySets> <moduleSets> <moduleSet> <useAllReactorProjects>true</useAllReactorProjects> <includes> <include>org.everydaycodes:app:jar:</include> <include>org.everydaycodes:tools:jar:</include> </includes> <binaries> <unpack>false</unpack> <includeDependencies>false</includeDependencies> </binaries> </moduleSet> </moduleSets> </assembly>
<format> 
dir değeri kullanılır. Açıklaması şöyle
we set the format to dir. This means the resulting artifact will be a folder with JAR files in it. As an alternative, you can change that to jar and get one BIG jar file with all resources and dependencies
<dependencySet>
 Açıklaması şöyle. Kendi kodum olan dependency'lerimi kopyalamıyorum, çünkü bunlar moduleSet ile kopyalanacak
useProjectArtifact: We say that do not use the artifact from the module itself
outputDirectory: Put the dependencies in the folder named shared  
unpack: keep them as JAR files instead of unpacking 
exclude: exclude the app and tools from the dependency list.



Hiç yorum yok:

Yorum Gönder

Local Snapshot Kullanmak

Örnek Şöyle yaparız <repository> <id>snapshot-repository</id> <name>Maven2 Snapshot Repository</name> &l...