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:
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
I found this blog post to be a good tutorial on how to do this.
Also, I think the name of the folder in which you place your files is relevant. Maven obviously does different things with files in src/main/java
than with files in src/main/resources
. I'm not 100% sure, but the name of this folder might mean the difference between a file ending up inside the jar or not.
Here is a list of Maven directory name properties.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments