You can do it in a single module. Since a self-executable war is
non-standard, the war plugin doesn't know that a main class should be
in the root. Here's how I do it:
       <plugin>
           <artifactId>maven-antrun-plugin</artifactId>
           <executions>
               <execution>
                   <id>move-main-class</id>
                   <phase>compile</phase>
                   <configuration>
                       <tasks>
                           <move
todir="${project.build.directory}/${project.artifactId}">
                             <fileset dir="${project.build.directory}/classes/">
                               <include name="MyWebApp*.class" />
                             </fileset>
                           </move>
                       </tasks>
                   </configuration>
                      <goals>
                        <goal>run</goal>
                      </goals>
               </execution>
           </executions>
       </plugin>

Kalle

On Mon, Jun 1, 2009 at 11:33 PM, Stephen Connolly
<[email protected]> wrote:
> You'll probably want to put your main class in a separate jar and then use
> dependency:unpack-dependencies to unpack the main class
>
> 2009/6/2 nambi sankaran <[email protected]>
>
>> Hi All
>>
>> I am trying to embed jetty into a war file, so that the war file becomes
>> executable.
>>    java -jar mywar.war
>> will start jetty on port 8080. ie, Main-Class will start Jetty
>> programmatically.
>>
>> To achieve this I have added configuration section for war plugin,
>>
>>     <build>
>>         <finalName>testwar</finalName>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-war-plugin</artifactId>
>>                 <configuration>
>>                     <archive>
>>                         <manifest>
>>                             <mainClass>TestMain</mainClass>
>>                         </manifest>
>>                     </archive>
>>                 </configuration>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>>
>> This results in correct MANIFEST.MF file, with the following entry
>>         Main-Class : TestMain
>>
>> Howvever,  TestMain class is coped to WEB-INF/classes directory
>> To make the war executable, the TestMain should be at the root level of war
>> file.
>>
>> The war plugin documentation doesn't provide enough information how to
>> configure the plugin, to copy "Main-Class"  to root level.
>>
>> Have anyone come across this issue?
>>
>> Thanks
>> Nambi
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to