Normally I would agree with you... except that he's using Assembly
plugin to build a jar-with-dependencies, which means the manifest.mf
file ends up looking like:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)

even if you configure the mainClass in m-jar-p as documented on the
webpage you linked.

So... you actually need to add the archive configuration into the
assembly plugin, as follows:
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-assembly-plugin</artifactId>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <configuration>
                          <descriptorRefs>

<descriptorRef>jar-with-dependencies</descriptorRef>
                          </descriptorRefs>
                          <archive>
                              <manifest>

<mainClass>com.agamura.thermota.Thermota</mainClass>
                                  <addClasspath>true</addClasspath>
                              </manifest>
                          </archive>
                      </configuration>
                      <goals>
                          <goal>single</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>

I've tested and this works.

Wayne

On 3/23/07, Phill Moran <[EMAIL PROTECTED]> wrote:
Here is the link to add main class to jar

http://maven.apache.org/plugins/maven-jar-plugin/examples/executable-jar.html



-----Original Message-----
From: Wayne Fay [mailto:[EMAIL PROTECTED]
Sent: March 23, 2007 12:25 PM
To: Maven Users List
Subject: Re: Newby Questions...

I took a look at your zip file... Here's my feedback:

1. Put your i18n language files in:
thermota-cli\src\main\resources\com\agamura\thermota
Thermota.properties
Thermota_de.properties
Thermota_fr_CA.properties
etc

After adding these files, I was successfully able to test with multiple Locales
ie:
java com.agamura.thermota.Thermota
java -Duser.language=de com.agamura.thermota.Thermota java -Duser.language=fr
-Duser.country=CA com.agamura.thermota.Thermota

2. In your properties file, you have comman.Exit which should be command.Exit.

3. I created a jar-with-dependencies in thermota-cli by adding the following to
that pom:
<build>
    <plugins>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-assembly-plugin</artifactId>
               <executions>
                   <execution>
                       <phase>package</phase>
                       <configuration>
                           <descriptorRefs>

<descriptorRef>jar-with-dependencies</descriptorRef>
                           </descriptorRefs>
                       </configuration>
                       <goals>
                           <goal>single</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
    </plugins>
  </build>

This bundles all of your class files and those of your dependencies inside one
larger Jar that is more or less "ready to run". However, at this moment, I did
not configure Maven to correctly insert the MainClass attribute inside the
Manifest.MF file, and so you cannot run it directly by using java -jar ... So I
just unzipped the Jar, and ran java directly from the command line.

I don't use Assembly much so I'm not positive how to configure it to generate
this Manifest file, but I assume this is possible.

Wayne

On 3/22/07, Giuseppe Greco <[EMAIL PROTECTED]> wrote:
> Right now there is just the default language... as soon as^I'm able to
> build and run the application in English, I'll add some other
> languages (configurable via command-line).
>
> j3d.
>
> Wayne Fay wrote:
> > Where are your I18N properties files? I just see the one (default,
> > English) properties file in thermota-cli. I assume you have another
> > lang or two already implemented, but did not include them in this
> > zip file for some reason?
> >
> > Wayne
> >
> > On 3/22/07, Giuseppe Greco <[EMAIL PROTECTED]> wrote:
> >> Hi guys,
> >>
> >> The source code of Thermota is avaialble at
> >> http://developer.agamura.com/resources/thermota-20070322.zip
> >>
> >> j3d.
> >>
> >> Wayne Fay wrote:
> >> > This mailing list does not accept most attachments; they are
> >> > automatically stripped by the email server.
> >> >
> >> > Is it possible for you to put a zip somewhere with the code, and
> >> > then perhaps one or more of us on this list can take a look at it?
> >> >
> >> > Wayne
> >> >
> >> > On 3/22/07, Giuseppe Greco <[EMAIL PROTECTED]> wrote:
> >> >> I've written an application to be used as a tutorial for Maven
> >> >> projects. That application implements a virtual thermometer with
> >> >> a command-line console, and consists of 3 modules: thermota-api
> >> >> (the thermometer interface), thermota-core (the thermometer
> >> >> implementation), and thermota-cli (the thermometer user interface).
> >> >>
> >> >> The code is complete and fully documented with javadoc, but in
> >> >> order to close this tutorial project (and of course, share it
> >> >> with you all), I need to integrate the I18N stuff and be able to
> >> >> generate a release (or runnable distro).
> >> >>
> >> >> I read the book "Better Builds with Maven", but I wasn't able to
> >> >> figure out how to solve these two last issues.
> >> >>
> >> >> Shall I post the source of Thermota to this mailing-list hoping
> >> >> that somebody could help me to finalize the POM?
> >> >>
> >> >> j3d.
> >> >>
> >> >> > Your properties files will generally go into
> >> >> > src/main/resources. I'm not aware of any existing
> >> >> > internationalized "Hello World" app built with Maven so if you
> >> >> > build one, please let us know so others can benefit.
> >> >> >
> >> >> > Wayne
> >> >> >
> >> >> > On 3/22/07, Giuseppe Greco <[EMAIL PROTECTED]> wrote:
> >> >> >> Thanks,
> >> >> >>
> >> >> >> Is there somewhere a POM example? I'm not able to find any
> >> >> >> exhaustive example...
> >> >> >>
> >> >> >> Where should I put the I16N *.properties files in the project
> >> >> >> structure? Even if I use a profile, I need to include the
> >> >> >> default resource bundle... Furthermore, what's about
> >> >> >> applications supporting more than one language?
> >> >> >>
> >> >> >> It would be great if I could find an internationalized "hello
> >> world"
> >> >> >> application built with Maven...
> >> >> >>
> >> >> >> j3d.
> >> >> >>
> >> >> >> > I think you are looking for maven 1)release and 2)profiles.
> >> >> >> > The
> >> >> first
> >> >> >> > requires
> >> >> >> > the release plug-in and the second will require a profile
> >> >> >> > for
> >> each
> >> >> >> > language/jar
> >> >> >> >
> >> >> >> > -----Original Message-----
> >> >> >> > From: Giuseppe Greco [mailto:[EMAIL PROTECTED]
> >> >> >> > Sent: March 22, 2007 7:33 AM
> >> >> >> > To: [email protected]
> >> >> >> > Subject: Newby Questions...
> >> >> >> >
> >> >> >> > Hi all,
> >> >> >> >
> >> >> >> > I'm looking at Maven as a replacement for Ant.
> >> >> >> >
> >> >> >> > I was able to create a small test application with Maven
> >> >> >> > and it
> >> >> works
> >> >> >> > fine. I
> >> >> >> > think Maven is really great!
> >> >> >> >
> >> >> >> > Since I'm really new to Maven, I've two questions:
> >> >> >> >
> >> >> >> > 1. How do I generate an application distro (i.e. a JAR that
> >> contains
> >> >> >> >    all the modules required to run the program)?
> >> >> >> >
> >> >> >> > 2. How does Maven support I18N (i.e. where should I put the
> >> >> >> >    MyApp_en_US.properties file or how do I instruct Maven
> >> >> >> > to
> >> include
> >> >> >> >    it in the package)?
> >> >> >> >
> >> >> >> > Thanks,
> >> >> >> > j3d.
> >> >> >> >
> >> >> >> > ----------------------------------------
> >> >> >> > Giuseppe Greco
> >> >> >> > Via CarĂ  26
> >> >> >> > 6928 Manno (TI)
> >> >> >> > Switzerland
> >> >> >> >
> >> >> >> > call giuseppe.greco via Skype
> >> >> >> > phone:  +41 (0)91 604 67 65
> >> >> >> > mobile: +41 (0)79 590 33 06
> >> >> >> > email:  [EMAIL PROTECTED]
> >> >> >> > ----------------------------------------
> >> >> >> >
> >> >> >> >
> >>
> >> -------------------------------------------------------------------
> >> -- 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]
> >
> >
>
> ---------------------------------------------------------------------
> 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]


---------------------------------------------------------------------
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