Hi Erik,

it is certainly possible to build stand-alone applications with maven. Maven just doesn't promotes a single way of doing this since there are many ways to create a stand-alone java application.

For the beginning:

You can configure the jar plugin as shown below to create the Main-Class entry and add the dependencies of your project to the Class-Path entry of the manifest:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>my.package.MainClass</mainClass>
            <addClasspath>true</addClasspath>
            <classpathPrefix>Your/prefix/here</classpathPrefix>
          </manifest>
        </archive>
      </configuration>
    </plugin>
  </plugins>
</build>

From there on some people just create a combined jar with the assembly plugin and the predefined 'jar-with-dependencies' configuration that includes all files of the dependencies. The documentation of the assembly plugin is available here: http://maven.apache.org/plugins/maven-assembly-plugin/

You can also copy the dependencies of your application (with the maven-dependency-plugin) to a path in your target directory so that they get jarred up with the other content of your jar during the packaging phase. Documentation is available here: http://mojo.codehaus.org/dependency-maven-plugin/

Another way would be to use pomstrap to run your application:
http://pomstrap.prefetch.com/en/

Hope this helps
-Tim

Midtskogen, Erik schrieb:
OK, so it seems that it's not possible to manage the build of a
stand-alone, desktop application entirely in Maven without resorting to
one or more hacks or manual processes.  I find it rather odd that the
most basic of all use-cases usually fulfilled by software build systems
is not yet supported by Maven.  But I'm willing to try my hand at
writing a plugin or goal to fulfill this need and give something back to
the Maven community.

Just to recap my earlier inquiry, what I'm looking for is a goal whose
resulting artifact is an executable jar file along with all the
dependencies it needs in order to run.  The goal would automatically
make the appropriate entries into the artifact jar's manifest.mf for the
main class and the jar file dependencies.  Then, it would copy the
dependency jar files themselves from the repository to the locations
specified in the manifest.mf.

Would anybody else here have a need for such a goal, or am I the only
one using Maven to build stand-alone Java apps?  If other people would
find such a goal useful, should I try to write it as a goal of the
assembly plugin, with the idea that I could submit it to a committer and
have it become a goal called, for example, assembly:stand-alone-app?

Any feedback or tips would be great--especially from someone who has
written a Maven goal before.

Thanks,
--Erik

***********************************************************************************
The information in this email (including any attachments) is confidential and 
may be legally privileged.  Access to this e-mail by anyone other than the 
intended addressee is unauthorized.  If you are not the intended recipient of 
this message, any review, disclosure, copying, distribution, retention, or any 
action taken or omitted to be taken in reliance on it (including any 
attachments) is prohibited and may be unlawful.  If you are not the intended 
recipient, please reply to or forward a copy of this message to the sender and 
delete the message, all attachments, and any copies thereof from your system 
and destroy any printout thereof.

______________________________________________________________________
The information in this email (including any attachments) is confidential and 
may be legally privileged. Access to this e-mail by anyone other than the 
intended addressee is unauthorized. If you are not the intended recipient of 
this message, any review, disclosure, copying, distribution, retention, or any 
action taken or omitted to be taken in reliance on it (including any 
attachments) is prohibited and may be unlawful. If you are not the intended 
recipient, please reply to or forward a copy of this message to the sender and 
delete the message, all attachments, and any copies thereof from your system 
and destroy any printout thereof.


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

Reply via email to