On Tue, Oct 14, 2008 at 3:18 AM, Beyer,Nathan <[EMAIL PROTECTED]> wrote:
> Are there any examples of using the dependency:build-classpath [1] to create
> a launcher script or something similar? Or should I be looking to another
> MOJO?
>
> Say I have a windows bat file, I'd like to insert into it a line, something
> like the following.
>
> set CLASSPATH="%~dp0MyApp-1.0.jar;%~dp0MapApp-Dependency-1.0.jar"
>
>
>
> [1]
> http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
I have the Class-Path: entry in META-INF/MANIFEST.MF for MyApp-1.0.jar set.
using:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Class-Path>config/</Class-Path>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
And then use the assembly plugin to ensure all dependencies are copied
into the lib/ directory.
Then you can do
java -jar MyApp-1.0.jar
to run your app.
I also have scripts in src/main/scripts like "start.bar"
java -jar ${project.artifactId}-${project.version}.jar start
which the assembly filters as they are copied into the assembly:
<files>
<file>
<source>src/main/scripts/start.bat</source>
<filtered>true</filtered>
</file>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]