View Javadoc

1   package org.apache.maven.cli.compat;
2   
3   import org.apache.maven.cli.MavenCli;
4   import org.codehaus.classworlds.ClassWorld;
5   
6   /**
7    * Main class used to shield the user from the rest of Maven in the event the user is using JDK < 1.5.
8    * 
9    * @since 2.2.0
10   */
11  public class CompatibleMain
12  {
13  
14      public static void main( String[] args )
15      {
16          ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );
17  
18          int result = main( args, classWorld );
19  
20          System.exit( result );
21      }
22  
23      /**
24       * @noinspection ConfusingMainMethod
25       */
26      public static int main( String[] args, ClassWorld classWorld )
27      {
28          // ----------------------------------------------------------------------
29          // Setup the command line parser
30          // ----------------------------------------------------------------------
31          
32          String javaVersion = System.getProperty( "java.specification.version", "1.5" );
33          if ( "1.4".equals( javaVersion ) || "1.3".equals( javaVersion ) 
34               || "1.2".equals( javaVersion )  || "1.1".equals( javaVersion ) )
35          {
36  	        System.out.println( "Java specification version: " + javaVersion );
37              System.err.println( "This release of Maven requires Java version 1.5 or greater." );
38              return 1;
39          }
40          
41          return MavenCli.main( args, classWorld );
42      }
43  }