2012-04-11 8 views
0

でAspectJのウィーバーのためのコンパイルレベルを、私はプロジェクトに簡単な注釈駆動型の側面を加え、IntelliJのは、それをコンパイルすることはできません:コンパイルレベルプロジェクトで(設定する必要がありますセットのIntelliJアイデア

annotation type patterns are only supported at Java 5 compliance level or above 

してくださいアドバイス、設定は、プロジェクト全体およびすべてのモジュールに対してJava 6に設定されています)、設定 - >アスペクトウィーバーではウィーバーを有効にし、アスペクトのリストを表示することのみが可能です。

UPDこの問題はOpenJDKに関連していました。なぜなら、aspectJ weaverプラグインはバージョンを正しく認識しなかったからです。パッチはメンテナーに提出されました。

--- src/common/se/expertsystem/intellij/PluginUtils.java.orig 2012-04-11 14:03:35.000000000 +0300 
+++ src/common/se/expertsystem/intellij/PluginUtils.java 2012-04-11 14:47:11.000000000 +0300 
@@ -31,32 +31,34 @@ 
    */ 
package se.expertsystem.intellij; 

+import com.intellij.openapi.application.ApplicationInfo; 
+import com.intellij.openapi.application.ApplicationManager; 
+import com.intellij.openapi.diagnostic.Logger; 
import com.intellij.openapi.module.Module; 
import com.intellij.openapi.module.ModuleManager; 
-import com.intellij.openapi.roots.ModuleRootManager; 
-import com.intellij.openapi.roots.OrderRootType; 
-import com.intellij.openapi.util.io.FileUtil; 
-import com.intellij.openapi.diagnostic.Logger; 
import com.intellij.openapi.progress.ProgressIndicator; 
import com.intellij.openapi.progress.ProgressManager; 
import com.intellij.openapi.project.Project; 
-import com.intellij.openapi.application.ApplicationInfo; 
-import com.intellij.openapi.application.ApplicationManager; 
-import com.intellij.openapi.vfs.VirtualFile; 
+import com.intellij.openapi.roots.ModuleRootManager; 
+import com.intellij.openapi.roots.OrderRootType; 
+import com.intellij.openapi.util.io.FileUtil; 
import com.intellij.openapi.vfs.VfsUtil; 
+import com.intellij.openapi.vfs.VirtualFile; 
import com.intellij.util.ActionRunner; 

-import java.util.List; 
-import java.util.ArrayList; 
-import java.util.Iterator; 
-import java.io.IOException; 
import java.io.File; 
-import java.lang.reflect.Method; 
+import java.io.IOException; 
import java.lang.reflect.InvocationTargetException; 
-import java.net.URL; 
+import java.lang.reflect.Method; 
+import java.net.MalformedURLException; 
import java.net.URI; 
import java.net.URISyntaxException; 
-import java.net.MalformedURLException; 
+import java.net.URL; 
+import java.util.ArrayList; 
+import java.util.Iterator; 
+import java.util.List; 
+import java.util.regex.Matcher; 
+import java.util.regex.Pattern; 

/** 
    * Class containing useful utility methods for IntelliJ IDEA plugins. 
@@ -68,6 +70,8 @@ 

    private static final Class[] NO_PARAMETERS = new Class[] {}; 

+ private static final Pattern jdkVersionResolver = Pattern.compile("(java|openjdk)\\s+version\\s+\"(\\d+)\\.(\\d+)"); 
+ 
    /** 
    * Find classpath for module. Returns list of <code>File</code>s. 
    * @param project Project to get classpath for. 
@@ -296,13 +300,21 @@ 
    */ 
    public static boolean isJava5(Module module) { 
    final String versionString = getJdkVersionString(module); // Example: java version "1.5.0_07" 
- if(versionString.startsWith("java version \"1.") && versionString.length() > "java version \"1.".length()) 
-  return versionString.charAt("java version \"1.".length()) >= '5'; 
- LOG.error("Unparsable version string: " + versionString); 
- return false; 
+ final Matcher versionMatcher = jdkVersionResolver.matcher(versionString); 
+ if (!versionMatcher.find()) { 
+  LOG.error("Unparsable version string (regex failed): " + versionString); 
+  return false; 
+ } else if (!("1".equals(versionMatcher.group(2)) 
+    && versionMatcher.group(3).charAt(0) >= '5')) { 
+  LOG.error("Version invalid: major "+versionMatcher.group(2)+ 
+  " , minor "+versionMatcher.group(3)); 
+  return false; 
+ } 
+ LOG.info("Detected JDK: "+versionString); 
+ return true; 
    } 

- ///////////////////////////////////////////////////////////////////////////// 
+ ///////////////////////////////////////////////////////////////////////////// 
    // Methods for progress indication 
    ///////////////////////////////////////////////////////////////////////////// 

@@ -382,4 +394,4 @@ 
     return modules; 
    } 
    } 
-} 
\ No newline at end of file 
+} 
+0

設定を確認する|コンパイラ| Javac、おそらくそのレベルはコンパイラオプションを介して設定されています。 – CrazyCoder

+0

@CrazyCoderは、コンパイラレベルがそこに設定されていないことを確認しました。-source 1.6 -target 1.6で設定しようとしましたが、どちらも役に立ちませんでした。 – jdevelop

+0

このサードパーティのプラグインはしばらく更新されていませんでした。http://plugins.intellij.net/plugin/?idea&id=1127のヘルプのために開発者にpingを試みるかもしれませんが、現在のIDEAのバージョン。 – CrazyCoder

答えて

1

あなたのbuild.xml

+0

この問題は、JDKバージョンの検出に関連するaspectJ weaverプラグインのエラーによるものです – jdevelop

0

にiajcタスクに挿入

を試してみてください、私はaspectjweaverジャーをアップグレードすることで、既存のコンプライアンスレベルのためにそれを解決しました。 Use aspectjweaver-1.7.3.jar

関連する問題