[ 
https://jira.codehaus.org/browse/MACR-3?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=282737#comment-282737
 ] 

Gustavo Orair commented on MACR-3:
----------------------------------

Lundberg,
As you recommended, I am sending missing pieces to be added in plugin site.

I would change inside the Usage Page
(http://maven.apache.org/plugins/maven-acr-plugin/usage.html):

I would add before "If the packaging type defined in the pom.xml is
app-client, the package lifecycle phase can be used" the sentence:
"Define the package type to be app-client."

Before:
"Pay attention that prior to Maven 3.0.4, the plugin's extension must
be enabled since the app-client packaging type is new."

I would add
"Pay attention that JEE spec requires to add a manifest and a
Main-Class. So, your application client need this to be JEE compliant."
See "How can I specify a Main-Class: entry in the manifest of an
Application Client jar?" inside FAQ for more details.

Note: Some application servers may execute an application client without a 
Main-Class if you specify the Main-Class while running, however specify 
Main-Class while running would not be possible for some technologies such as 
Java Web Start Technology.



Inside FAQ Page (http://maven.apache.org/plugins/maven-acr-plugin/faq.html):
Add as the FIRST question:
1 - How can I specify a Main-Class: entry in the manifest of an
Application Client jar?

JEE spec and also some launching technologies such as Java Web Start Technology 
require to add a manifest and a Main-Class in application clients. This 
requirement is done because the launching technology need to know which method 
to execute.
So, you need to configure Maven Archiver accordingly inside the acr-plugin 
configuration of your pom.xml app-client project. 
Here is a sample pom.xml configured to use the class fully.qualified.MainClass 
as the main class:

<project>
 ...
 <build>
   <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-acr-plugin</artifactId>
       ...
       <configuration>
         <archive>
           <manifest>
             <mainClass>fully.qualified.MainClass</mainClass>
           </manifest>
         </archive>
       </configuration>
       ...
     </plugin>
   </plugins>
 </build>
 ...
</project>

This configuration is really similar to making the jar executable for jar Maven 
projects. 
See "Make the jar executable" in Maven Archiver Examples Page for more details
(http://maven.apache.org/shared/maven-archiver/examples/classpath.html#aMake).

Optionally you can configure Archiver to use your own manifest file
with an already define Main-Class. Details can be found here
http://maven.apache.org/shared/maven-archiver/examples/manifestFile.html.


Obviously, a good improvement should be make maven acr plugin warns
the user if do not find a Main Class configuration neither a
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>.
In the case user added a manifestFile option and plugin couldn't check
if this manifestFile has a Main-Class, the plugin could at least info
the user to add a MainClass inside you own Manifest-File.

Best regards,

> Maven site should has an example with adding Main Class
> -------------------------------------------------------
>
>                 Key: MACR-3
>                 URL: https://jira.codehaus.org/browse/MACR-3
>             Project: Maven ACR Plugin
>          Issue Type: Improvement
>    Affects Versions: 1.0
>            Reporter: Gustavo Orair
>
> Maven ACR plugin should confirm if the resulting Manifest contain a setting 
> for Main-Class, because The Java EE spec requires that app clients specify 
> the main class 
> (http://www.java.net/forum/topic/glassfish/glassfish/problems-using-java-web-start-application-client-libraries-not-found).
> If Manifest does not contain Main-Class a warning should be emitted.
> Also, It would be very valuable if some examples specifying Main-Class are 
> added to the site http://maven.apache.org/plugins/maven-acr-plugin/.
> In actual configuration, users tend to create application clients without 
> Main-Class and may get strange errors while trying to launch the application 
> client. One example of these errors, may be accessed in:
> http://www.java.net/forum/topic/glassfish/glassfish/problems-using-java-web-start-application-client-libraries-not-found

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to