How do you create a maven assembly that includes shell scripts and properrties file not in jar?

Viewed 19053

Im trying to use Maven to build a standalone application

Using the assembly plugin described at How do you create a standalone application with dependencies intact using Maven?

This creates widget distribution zip containing

widget-1.0
widget-1.0/lib/widget.jar
widget-1.0/lib/3rdpartyjar1.jar
widget-1.0/lib/3rdpartyjar2.jar

...

but in my src tree I have:

src/main/bin/widget.sh 

and this doesnt make into the final distribution zip, I would like it to go here

widget-1.0/widget.sh

Also in my src tree i have a properties file in

src/main/properties/widget.properties

that currently make its way into

widget-1.0/lib/widget.jar

but because I want it to be editable I want it to be in

widget-1.0/widget.properties

Is it possible to do this within maven ?

EDIT Using information in blog got working as follows:

  1. Renamed bin folder to scripts folder because this is standard Maven name
  2. Moved widget.properties into script folder
  3. Modifed my assembly.xml to contain a fileset

Here is the new xml

<?xml version="1.0" encoding="UTF-8"?>
<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>distribution</id>
    <formats>
        <format>zip</format>
    </formats>
    <dependencySets>
        <dependencySet>
            <scope>runtime</scope>
            <outputDirectory>lib</outputDirectory>
            <unpack>false</unpack>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>${project.build.scriptSourceDirectory}</directory>
            <outputDirectory></outputDirectory>
            <includes>
                <include>widget.sh</include>
                <include>widget.properties</include>
            </includes>
        </fileSet>
    </fileSets>
</assembly>

However minor point but unable to find a list of maven standard folder variables anywhere , i.e is there an equivalent to ${project.build.scriptSourceDirectory} for the properties folder

1 Answers
Related