This is POM that we used to build a batch job that modified the database that was supporting a 60 WAR LMS project. A lot of the dependencies were on code that was shared across a lot of WAR projects

I hope that the POM and the jar-with-dependencies-assembly.xml file listings help you As you can see we used the maven-assembly-plugin rather than shade so it is not quite the same. I am not sure what extra stuff shade gives but we never used it even though we had to generate several batch jobs. As you can see, we never had to do much with classpaths. Maven seemed to know how to build the jar so that it worked with no problems. It only needed to know what to start running when java started it
<manifest>
<mainClass>com.artifact_software.lms.contractrenew.main.ContractRenewBatchMain</mainClass>
<packageName>com.artifact_software.lms.contractrenew.main</packageName>
</manifest>

I hope that this helps

Ron


------------------------------------------------------------------------------------------------------------------------------------
POM

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>

<parent>
<artifactId>lms-pom-master</artifactId>
<groupId>com.artifact_software.lms</groupId>
<version>1.9.1</version>
</parent>

<modelVersion>4.0.0</modelVersion>

<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-contractrenew-batch</artifactId>
<packaging>jar</packaging>
<version>1.11.3</version>

<name>Contract Auto Renew Application</name>

<description>Contract Auto Renew Application</description>
<prerequisites>
<maven>2.0.4</maven>
</prerequisites>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>jar-with-dependencies-assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.artifact_software.lms.contractrenew.main.ContractRenewBatchMain</mainClass>
<packageName>com.artifact_software.lms.contractrenew.main</packageName>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${pom.url}</url>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-pom-lms-libraries</artifactId>
<version>1.11.1</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
.
.
.Lots more of them here.
.
</dependency>
</dependencies>

</project>
----------------------------------------------------
jar-with-dependencies-assembly.xml
---------------------
<assembly>
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping></outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>

</assembly>

------------------------------------------------------

Ron
What I can see from your description is a pretty standard set of projects
that should not require any special set up or plug-ins.
It looks like a few jar POMs to make your libraries from your code, a war
POM to make the WAR using the WAR plug-in and another jar POM to make the
executable.

Google for "maven executable jar" gives lots of listings including this
gem.


http://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html


The shade plugin adds the main class to the manifest perfectly, but I don't
see how I can add the classpath reference?




--
Ron Wheeler
President
Artifact Software Inc
email: [email protected]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to