An assembly file consists of three sections
<id> |
the id. |
<formats> |
list of package formats that should be generated, each in <format> descriptor |
<format> |
jar, tar.gz, tar.bz2, zip if you know of others, please add them here |
<includeBaseDirectory> |
defaults to false. Determines if the base directory should be included in the package. |
<outputDirectory> |
Directory in the target tree where the files should be copied to. |
<directory> |
copies the contents of this directory to the specified target directory. Copies files by name, does not copy path. if anyone could clarify what other types of patterns can be specified that would be great! |
<includes> |
copies the specified files that match the pattern (e.g. *.txt) to the target directory. Includes the directory path when copying. |
<excludes> |
Excludes the specified files that match the pattern (e.g. *.txt) from being copied to the target directory. |
<lineEnding> |
|
<directoryMode> |
|
<fileMode> |
|
<outputDirectory> |
Directory in the target tree where the dependencies should be copied to. |
<includes> |
Includes the specified dependency |
<excludes> |
Excludes the specified dependency |
<unpack> |
Unpacks the contents of the dependencies |
<scope> |
|
<outputFileNameMapping> |
|
<directoryMode> |
|
<fileMode> |
|
If you have seen WARNING during your archetype:create run with message that says parameter "blah" is not defined, then it's because you have a dollar sign variables in your archetype template files that's not escaped.
Any file under src/main/resources/archetyp-resources are consider templates and will process by Velicity engine. Variables such as ${artifactId}, ${goupId}, and ${version} will get substitued for value during runtime when you create the archetype. But if you need to specifically want ${artifactId} to not get substituted, then you need to escape it. The easiest way is add this on top of src/main/resources/archetyp-resources/pom.xml
#set($dollar = '$')
Then any variable you want to escape can be written in the form of ${dollar}{artifactId}. This ${dollar} variable will visible to all template files, which comes in handy if you need to generated JSP pages that want EL expression stays intact.
This can be accomplished with the assembly:directory goal. There is only a small downside: The directory
goal always creates a folder below the target directory that is version-specific. This version-specific directory
is even created when <includeBaseDirectory> is set to false (that may be a bug).
This explains how to create your own predefine assembly and make it available to other projects using a simple refId.
<project ...>
<artifactId>myAssemblies</artifactId>
<groupId>com.mycompany.mygroup</groupId>
<version>1.0.0</version>
<packaging>jar</packaging>
</project>
|
<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>
|
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</build>
|
Use the Remote Resources Plugin to process LICENSE and NOTICE files for inclusion in your assembly
From #maven 20070713
<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 |