Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a simple jar module
    Code Block
    <project ...>
            <artifactId>myAssemblies</artifactId>
            <groupId>com.mycompany.mygroup</groupId>
            <version>1.0.0</version>
            <packaging>jar</packaging>
    </project>
    
    Your project just need to contain the assambly descriptor file (the directory "assemblies" is required):
            src\/main\/resources\/assemblies/my-distribution.xml
    the name of your assembly ("my-distribution") is the refId that will be use in descriptorRef tag.
    In this project be sure to disable filtering on resources folder otherwise variables like ${artifactId} will be replaced....
  2. Then in a pom parent  (my-pom-parent) you need to declare the assembly configuration:
    Code Block
    <build>
    
     <pluginManagement>
      <plugins>
       <plugin>
    
        <artifactId>maven-assembly-plugin</artifactId>
    
         <configuration>
          <descriptorRefs>
           <descriptorRef>my-distribution</descriptorRef>
          </descriptorRefs>
         </configuration>
    
         <executions>
          <execution>
           <id>my-assembly</id>
           <phase>package</phase>
           <goals>
            <goal>assembly</goal>
           </goals>
          </execution>
         </executions>
    
         <dependencies>
          <dependency>
           <groupId>com.mycompany.mygroup</groupId>
           <artifactId>myAssemblies</artifactId>
           <version>1.0.0</version>
          </dependency>
         </dependencies>
    
        </plugin>
       </plugins>
      </pluginManagement>
    </build>
    
    "pluginManagement" is used in this example, but you can directly use "plugins" tag in your project.
  3. And Then in your project (that inherite from the "my-pom-parent") you just need to declare the usage of the assembly plugin:
    Code Block
    <build>
            <plugins>
                 <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                 </plugin>
            </plugins>
       </build>
    
    Of course you can overwrite default plugin configuration.

...