Author: brett Date: Sun Oct 23 15:36:53 2005 New Revision: 327871 URL: http://svn.apache.org/viewcvs?rev=327871&view=rev Log: PR: MNG-1000
adjust assertions and jdk 1.5 language features based on JDK being used Modified: maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java Modified: maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java?rev=327871&r1=327870&r2=327871&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java (original) +++ maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java Sun Oct 23 15:36:53 2005 @@ -77,6 +77,13 @@ */ 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 @@ { 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" ); + } } /**