mirror of
https://github.com/apache/maven.git
synced 2025-02-08 19:15:12 +00:00
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:
parent
73ecb763cc
commit
42204a5125
@ -77,6 +77,13 @@ public class IdeaMojo
|
|||||||
*/
|
*/
|
||||||
private String jdkName;
|
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()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
@ -438,6 +445,27 @@ private void setJdkName( Xpp3Dom content, String jdkName )
|
|||||||
{
|
{
|
||||||
Xpp3Dom component = findComponent( content, "ProjectRootManager" );
|
Xpp3Dom component = findComponent( content, "ProjectRootManager" );
|
||||||
component.setAttribute( "project-jdk-name", jdkName );
|
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" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user