Quantcast

examples of using build-classpath to create a launcher script

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

examples of using build-classpath to create a launcher script

Beyer,Nathan
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Brett Porter
You might consider the appassembler plugin over at mojo.codehaus.org.

- Brett

2008/10/14 Beyer,Nathan <[hidden email]>:

> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Barrie Treloar
In reply to this post by Beyer,Nathan
On Tue, Oct 14, 2008 at 3:18 AM, Beyer,Nathan <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...