Versions Compared

Key

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

...

Descriptor format - most descriptors have no description

Pre-defined Descriptor Files

Goals

  • assembly:assembly (default goal) Creates a distribution artifact
  • assembly:directory copies files into a directory structure without packing those file
  • assembly:unpack unpacks packed files

...

  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.

...

From #maven 20070713

No Format

<wsmoak> jdcasey:  what version of the assembly plugin do you recommend using ?  I haven't been following it closely.
<jdcasey> I'm partial to the 2.2-b-2-snap, but 2.2-beta-1 is okay, provided you know some things
<jdcasey> what are you trying to do with it?
<wsmoak> make assemblies :)  what things?
<jdcasey> e.g. if you need to unpack dependencies, you'll have to set <outputFileNameMapping></outputFileNameMapping> (blank)
<jdcasey> lol
<jdcasey> that's the big one
<jdcasey> it's fixed in 2.2b2-snap
<jdcasey> fwiw
<jdcasey> wsmoak: and we're still trying to work out the kinks in repo building...that one's troublesome
<jdcasey> I think those are the biggies

...