You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Beyer,Nathan" <NB...@CERNER.COM> on 2008/10/13 18:48:26 UTC

examples of using build-classpath to create a launcher script

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



----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

Re: examples of using build-classpath to create a launcher script

Posted by Brett Porter <br...@gmail.com>.
You might consider the appassembler plugin over at mojo.codehaus.org.

- Brett

2008/10/14 Beyer,Nathan <NB...@cerner.com>:
> 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
>
>
>
> ----------------------------------------------------------------------
> CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
>



-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: examples of using build-classpath to create a launcher script

Posted by Barrie Treloar <ba...@gmail.com>.
On Tue, Oct 14, 2008 at 3:18 AM, Beyer,Nathan <NB...@cerner.com> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org