PR: MNG-1000

adjust assertions and jdk 1.5 language features based on JDK being used

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@327871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-23 22:36:53 +00:00
parent 73ecb763cc
commit 42204a5125
1 changed files with 28 additions and 0 deletions

View File

@ -77,6 +77,13 @@ public class IdeaMojo
*/
private String jdkName;
/**
* Specify the version of the JDK to use for the project for the purpose of enabled assertions and 5.0 language features.
* The default value is the specification version of the executing JVM.
* @parameter expression="${jdkLevel}"
*/
private String jdkLevel;
public void execute()
throws MojoExecutionException
{
@ -438,6 +445,27 @@ Can't run this anyway as Xpp3Dom is in both classloaders...
{
Xpp3Dom component = findComponent( content, "ProjectRootManager" );
component.setAttribute( "project-jdk-name", jdkName );
String jdkLevel = this.jdkLevel;
if ( jdkLevel == null )
{
jdkLevel = System.getProperty( "java.specification.version" );
}
if ( jdkLevel.startsWith( "1.4" ) )
{
component.setAttribute( "assert-keyword", "true" );
component.setAttribute( "jdk-15", "false" );
}
else if ( jdkLevel.compareTo( "1.5" ) >= 0 )
{
component.setAttribute( "assert-keyword", "true" );
component.setAttribute( "jdk-15", "true" );
}
else
{
component.setAttribute( "assert-keyword", "false" );
}
}
/**