Put the following in the <build> section of your pom:

      <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.acme.MainClass</mainClass>
                            <addClasspath>true</addClasspath>
                            <addExtensions>true</addExtensions>
                            <classpathPrefix>./lib/</classpathPrefix>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>

the <classpathPrefix> depends where You put Your dependend jars relative
to the created jar file.
  

-----Original Message-----
From: Erick Dovale [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 28, 2005 11:34 PM
To: Maven Users List
Subject: [M2] jar plugin and the jar manifest

Hello there,
I am generating my jars perfectly using maven-jar-plugin. I see it
actually creates a minifest file and includes it in the jar file which
is perfect. However, I need this jar to be executable and the plugin
does not add the classpath entries to the manifest. How can I have this
plugin to add the classpath to the manifest? I also need to add the main
class entry in the manifest but this one has to be specified in the pom
somehow.
Reading through the list I see there is a way to add manifest entries in
the configuration of the jar plugin however, I was unable to find an
example of a pom doing this. I am assuming it is something like this:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <manifestEntries>
                        <manifestEntry></manifestEntry>
                    </manifestEntries>
                </configuration>
            </plugin>

But then how can I speciefy the key/value pair? should I go like:
<manifestEntry>
    <key>...</key>
    <value>...</value>
</manifestEntry>

If it is like this, There should be a variable somewhere that refers to
the runtime classpath for the project; how is it called??
Thanks a lot.

edovale




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to