You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/24 00:36:58 UTC
svn commit: r327871 -
/maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
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" );
+ }
}
/**