o Removed unreachable code (older JVMs will always bail out before the code is executed)

M:\apache-maven-3.0-SNAPSHOT\bin>mvn -v
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadRealmClass(ClassRealm.java:174)
        at org.codehaus.plexus.classworlds.strategy.DefaultStrategy.loadClass(DefaultStrategy.java:67)
        at org.codehaus.plexus.classworlds.strategy.ForeignStrategy.loadClass(ForeignStrategy.java:39)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:207)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:201)
        at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:31)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@729292 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-12-24 10:52:56 +00:00
parent 7f8675a19e
commit 3ec459f512
2 changed files with 0 additions and 90 deletions

View File

@ -84,15 +84,6 @@ public class MavenCli
return 1;
}
if ( "1.5".compareTo( System.getProperty( "java.specification.version" ) ) > 0 )
{
System.err.println();
System.err.println( "You need JDK 1.5 or above to execute Maven 3.x." );
System.err.println();
return 1;
}
boolean debug = commandLine.hasOption( CLIManager.DEBUG );
boolean quiet = !debug && commandLine.hasOption( CLIManager.QUIET );

View File

@ -1,81 +0,0 @@
package org.apache.maven.cli;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import junit.framework.TestCase;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.util.StringOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
/**
* Test method for 'org.apache.maven.cli.MavenCli.main(String[], ClassWorld)'
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id$
*/
public class MavenCliTest
extends TestCase
{
/**
* Test that JDK 1.4 or above is required to execute MavenCli
*
* @throws Exception
*/
public void testMain()
throws Exception
{
ClassWorld classWorld = new ClassWorld();
PrintStream oldErr = System.err;
PrintStream oldOut = System.out;
OutputStream errOS = new StringOutputStream();
PrintStream err = new PrintStream( errOS );
System.setErr( err );
OutputStream outOS = new StringOutputStream();
PrintStream out = new PrintStream( outOS );
System.setOut( out );
try
{
System.setProperty( "java.specification.version", "1.0" );
assertEquals( 1, MavenCli.main( new String[] { "-h" }, classWorld ) );
System.setProperty( "java.specification.version", "1.1" );
assertEquals( 1, MavenCli.main( new String[] { "-h" }, classWorld ) );
System.setProperty( "java.specification.version", "1.2" );
assertEquals( 1, MavenCli.main( new String[] { "-h" }, classWorld ) );
System.setProperty( "java.specification.version", "1.3" );
assertEquals( 1, MavenCli.main( new String[] { "-h" }, classWorld ) );
System.setProperty( "java.specification.version", "1.4" );
assertEquals( 1, MavenCli.main( new String[] { "-h" }, classWorld ) );
System.setProperty( "java.specification.version", "1.5" );
assertEquals( 0, MavenCli.main( new String[] { "-h" }, classWorld ) );
System.setProperty( "java.specification.version", "1.6" );
assertEquals( 0, MavenCli.main( new String[] { "-h" }, classWorld ) );
}
finally
{
System.setErr( oldErr );
System.setOut( oldOut );
}
}
}